Learn R Programming

redcapAPI (version 2.9.1)

userRoleAssignmentMethods: Export or Import User-Role Assignments

Description

These methods enable the user to export the user-role assignments, add assignments, or modify existing assignments.

Usage

exportUserRoleAssignments(rcon, ...)

importUserRoleAssignments(rcon, data, ...)

# S3 method for redcapApiConnection exportUserRoleAssignments( rcon, ..., error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

# S3 method for redcapApiConnection importUserRoleAssignments( rcon, data, ..., error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

Value

exportUserRoleAssignments returns a data frame with the columns:

usernameUsername of a user in the project.
unique_role_nameThe unique role name to which the user is assigned.
data_access_groupThe Data Access Group to which the user is assigned.

importUserRoleAssignments invisibly returns the number of user roles assignments added or modified.

Arguments

rcon

A redcapConnection object.

data

data.frame with columns username and unique_role_name. Each username must be unique. Users without a unique_role_name will not be assigned to a user role.

...

Arguments to pass to other methods

error_handling

character(1). One of c("error", "null"). An option for how to handle errors returned by the API. see redcapError().

config

A named list. Additional configuration parameters to pass to httr::POST(). These are appended to any parameters in rcon$config.

api_param

A named list. Additional API parameters to pass into the body of the API call. This provides users to execute calls with options that may not otherwise be supported by redcapAPI.

Functions

  • exportUserRoleAssignments(): Export user-role assignments from a project.

  • importUserRoleAssignments(): Import user-role assignments to a project.

See Also

exportUsers(),
importUsers(),
deleteUsers(),
exportUserRoles(),
importUserRoles(),
deleteUserRoles()

Examples

Run this code
if (FALSE) {
unlockREDCap(connections = c(rcon = "project_alias"), 
             url = "your_redcap_url", 
             keyring = "API_KEYs", 
             envir = globalenv())
             
# Export user-role assignments
exportUserRoleAssignments(rcon)

# Import/modify a user-role assignment
NewData <- data.frame(username = "desired_user_name", 
                      unique_role_name = "KN3430U")
importUserRolesAssignments(rcon, 
                           data = NewData)
}

Run the code above in your browser using DataLab