inst/examples/delete_all_users_except.R

## This script deletes all users in a database, except those in the
## emailsToKeep vector.


library(activityinfo)
activityInfoLogin()

databaseId <- "d0000010391"
emailsToKeep <- c("a@example.org", "b@example.org")

users <- getDatabaseUsers(databaseId)

for(user in users) {
  
  if(!(tolower(user$email) %in% emailsToKeep)) {
    cat(sprintf("Deleting %s...\n", user$email))
    deleteDatabaseUser(databaseId, user$userId)
  }
}
bedatadriven/activityinfo-R documentation built on Dec. 21, 2024, 8:23 a.m.