Skip to content

Commit

Permalink
feat: remove user from site
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomeriko96 committed Jan 4, 2024
1 parent 776f524 commit 3e9005f
Show file tree
Hide file tree
Showing 24 changed files with 129 additions and 22 deletions.
36 changes: 36 additions & 0 deletions R/remove_user_from_site.R
Original file line number Diff line number Diff line change
@@ -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)
)
}
3 changes: 2 additions & 1 deletion man/add_tags_to_view.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/add_tags_to_workbook.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/authenticate_server.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/download_filtered_tableau_image.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/download_tableau_crosstab_excel.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/download_tableau_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/download_workbooks_server.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/download_workbooks_server_pdf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/download_workbooks_server_powerpoint.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_connected_apps.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_datasources.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_groups.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_info.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_jobs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_projects.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_refresh_tasks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_schedules.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_user_favorites.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_users.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_views.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_server_workbooks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/get_table_assets.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions man/remove_user_from_site.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3e9005f

Please sign in to comment.