diff --git a/R/remove_user_from_site.R b/R/remove_user_from_site.R new file mode 100644 index 0000000..6b040f5 --- /dev/null +++ b/R/remove_user_from_site.R @@ -0,0 +1,36 @@ +#' Remove User from Site +#' +#' Removes a user from the specified site. The user will be deleted if they do not own any other assets other than subscriptions. If a user still owns content (assets) on Tableau Server, the user cannot be deleted unless the ownership is reassigned first. +#' +#' @param tableau A list containing the Tableau authentication variables: `base_url`, `token`, `user_id`, and `site_id`. +#' @param api_version The version of the API to use, such as 3.19 (default: 3.19). +#' @param user_id The ID of the user to remove. +#' @param mapAssetsTo Optional. The ID of a user that receives ownership of contents of the user being removed. +#' +#' @return No return value. +#' +#' @family Tableau REST API +remove_user_from_site <- function(tableau, api_version = 3.19, user_id, mapAssetsTo = NULL) { + base_url <- tableau$base_url + token <- tableau$token + site_id <- tableau$site_id + + url <- paste0( + base_url, + "api/", + api_version, + "/sites/", + site_id, + "/users/", + user_id + ) + + if (!is.null(mapAssetsTo)) { + url <- paste0(url, "?mapAssetsTo=", mapAssetsTo) + } + + httr::DELETE( + url, + httr::add_headers("X-Tableau-Auth" = token) + ) +} diff --git a/man/add_tags_to_view.Rd b/man/add_tags_to_view.Rd index f3cb161..5b5ea68 100644 --- a/man/add_tags_to_view.Rd +++ b/man/add_tags_to_view.Rd @@ -43,6 +43,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/add_tags_to_workbook.Rd b/man/add_tags_to_workbook.Rd index 71fd5d2..97f5b7e 100644 --- a/man/add_tags_to_workbook.Rd +++ b/man/add_tags_to_workbook.Rd @@ -43,6 +43,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/authenticate_server.Rd b/man/authenticate_server.Rd index 710ce4f..da3cef5 100644 --- a/man/authenticate_server.Rd +++ b/man/authenticate_server.Rd @@ -43,6 +43,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/download_filtered_tableau_image.Rd b/man/download_filtered_tableau_image.Rd index a6b3836..9f8258e 100644 --- a/man/download_filtered_tableau_image.Rd +++ b/man/download_filtered_tableau_image.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/download_tableau_crosstab_excel.Rd b/man/download_tableau_crosstab_excel.Rd index af1e08b..b319ce0 100644 --- a/man/download_tableau_crosstab_excel.Rd +++ b/man/download_tableau_crosstab_excel.Rd @@ -45,6 +45,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/download_tableau_data.Rd b/man/download_tableau_data.Rd index dbd21b8..94f3925 100644 --- a/man/download_tableau_data.Rd +++ b/man/download_tableau_data.Rd @@ -40,6 +40,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/download_workbooks_server.Rd b/man/download_workbooks_server.Rd index 9f71171..0d28189 100644 --- a/man/download_workbooks_server.Rd +++ b/man/download_workbooks_server.Rd @@ -51,6 +51,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/download_workbooks_server_pdf.Rd b/man/download_workbooks_server_pdf.Rd index 443a166..ac8c496 100644 --- a/man/download_workbooks_server_pdf.Rd +++ b/man/download_workbooks_server_pdf.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/download_workbooks_server_powerpoint.Rd b/man/download_workbooks_server_powerpoint.Rd index 5b618b7..93ab95a 100644 --- a/man/download_workbooks_server_powerpoint.Rd +++ b/man/download_workbooks_server_powerpoint.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_connected_apps.Rd b/man/get_server_connected_apps.Rd index a33d981..04a8cee 100644 --- a/man/get_server_connected_apps.Rd +++ b/man/get_server_connected_apps.Rd @@ -41,6 +41,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_datasources.Rd b/man/get_server_datasources.Rd index 9cc6432..feadff6 100644 --- a/man/get_server_datasources.Rd +++ b/man/get_server_datasources.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_groups.Rd b/man/get_server_groups.Rd index dadcd0d..7fb90d1 100644 --- a/man/get_server_groups.Rd +++ b/man/get_server_groups.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_info.Rd b/man/get_server_info.Rd index 53f5c22..432861e 100644 --- a/man/get_server_info.Rd +++ b/man/get_server_info.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_jobs.Rd b/man/get_server_jobs.Rd index af05982..db4b4fc 100644 --- a/man/get_server_jobs.Rd +++ b/man/get_server_jobs.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_projects.Rd b/man/get_server_projects.Rd index 99dce6e..576f694 100644 --- a/man/get_server_projects.Rd +++ b/man/get_server_projects.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_refresh_tasks.Rd b/man/get_server_refresh_tasks.Rd index 6d9c619..8e84045 100644 --- a/man/get_server_refresh_tasks.Rd +++ b/man/get_server_refresh_tasks.Rd @@ -41,6 +41,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_schedules.Rd b/man/get_server_schedules.Rd index d8d5195..95d7efe 100644 --- a/man/get_server_schedules.Rd +++ b/man/get_server_schedules.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_user_favorites.Rd b/man/get_server_user_favorites.Rd index b59aa37..03a7f3e 100644 --- a/man/get_server_user_favorites.Rd +++ b/man/get_server_user_favorites.Rd @@ -51,6 +51,7 @@ Other Tableau REST API: \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_users.Rd b/man/get_server_users.Rd index 567285b..ac703e6 100644 --- a/man/get_server_users.Rd +++ b/man/get_server_users.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_user_favorites}()}, \code{\link{get_server_views}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_views.Rd b/man/get_server_views.Rd index 18a1025..a8d9148 100644 --- a/man/get_server_views.Rd +++ b/man/get_server_views.Rd @@ -51,6 +51,7 @@ Other Tableau REST API: \code{\link{get_server_user_favorites}()}, \code{\link{get_server_users}()}, \code{\link{get_server_workbooks}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_server_workbooks.Rd b/man/get_server_workbooks.Rd index 10b3d5a..6dcb3fb 100644 --- a/man/get_server_workbooks.Rd +++ b/man/get_server_workbooks.Rd @@ -48,6 +48,7 @@ Other Tableau REST API: \code{\link{get_server_user_favorites}()}, \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, -\code{\link{get_table_assets}()} +\code{\link{get_table_assets}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/get_table_assets.Rd b/man/get_table_assets.Rd index 3c5fd57..47f7274 100644 --- a/man/get_table_assets.Rd +++ b/man/get_table_assets.Rd @@ -39,6 +39,7 @@ Other Tableau REST API: \code{\link{get_server_user_favorites}()}, \code{\link{get_server_users}()}, \code{\link{get_server_views}()}, -\code{\link{get_server_workbooks}()} +\code{\link{get_server_workbooks}()}, +\code{\link{remove_user_from_site}()} } \concept{Tableau REST API} diff --git a/man/remove_user_from_site.Rd b/man/remove_user_from_site.Rd new file mode 100644 index 0000000..d8664d9 --- /dev/null +++ b/man/remove_user_from_site.Rd @@ -0,0 +1,49 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/remove_user_from_site.R +\name{remove_user_from_site} +\alias{remove_user_from_site} +\title{Remove User from Site} +\usage{ +remove_user_from_site(tableau, api_version = 3.19, user_id, mapAssetsTo = NULL) +} +\arguments{ +\item{tableau}{A list containing the Tableau authentication variables: `base_url`, `token`, `user_id`, and `site_id`.} + +\item{api_version}{The version of the API to use, such as 3.19 (default: 3.19).} + +\item{user_id}{The ID of the user to remove.} + +\item{mapAssetsTo}{Optional. The ID of a user that receives ownership of contents of the user being removed.} +} +\value{ +No return value. +} +\description{ +Removes a user from the specified site. The user will be deleted if they do not own any other assets other than subscriptions. If a user still owns content (assets) on Tableau Server, the user cannot be deleted unless the ownership is reassigned first. +} +\seealso{ +Other Tableau REST API: +\code{\link{add_tags_to_view}()}, +\code{\link{add_tags_to_workbook}()}, +\code{\link{authenticate_server}()}, +\code{\link{download_filtered_tableau_image}()}, +\code{\link{download_tableau_crosstab_excel}()}, +\code{\link{download_tableau_data}()}, +\code{\link{download_workbooks_server_pdf}()}, +\code{\link{download_workbooks_server_powerpoint}()}, +\code{\link{download_workbooks_server}()}, +\code{\link{get_server_connected_apps}()}, +\code{\link{get_server_datasources}()}, +\code{\link{get_server_groups}()}, +\code{\link{get_server_info}()}, +\code{\link{get_server_jobs}()}, +\code{\link{get_server_projects}()}, +\code{\link{get_server_refresh_tasks}()}, +\code{\link{get_server_schedules}()}, +\code{\link{get_server_user_favorites}()}, +\code{\link{get_server_users}()}, +\code{\link{get_server_views}()}, +\code{\link{get_server_workbooks}()}, +\code{\link{get_table_assets}()} +} +\concept{Tableau REST API}