Invites a user to a database.
addDatabaseUser( databaseId, email, name, locale = NA_character_, roleId, roleParameters = list(), roleResources = list(databaseId) )
||the id of the database to which they should be added|
|the user's email|
||the user's name (only used if they do not already have an ActivityInfo account)|
||the locale ("en', "fr", "ar", etc) to use inviting the user (only used if they do not already have an ActivityInfo account)|
||the id of the role to assign to the user.|
||a named list containing the role parameter values|
||a list of folders in which this role should be assigned (or the databaseId if they should have this role in the whole database)|
This function adds a new user to a database and assigns them a role.
If there is no user account with the given email address, an email is sent in the given locale to the email address inviting the user to activate their account.
If there is an ActivityInfo account with the given email address, an email is sent notifying the user of their new role.
In ActivityInfo, permissions are managed through roles . Roles include a set of permissions. When a user is assigned a role, they inherit those permissions from the role.
Some roles are parameterized . For example, the "Reporting Partner" role included in many database templates has a
partner parameter that is used to filter which records are visible to the user. The value of this parameter is the record id of the user's partner in the related Partner form.
# Invite a user in the French locale, in the admin role. # The invitation email will be in French. addDatabaseUser(databaseId = "ck3pqrp9a1z", email = "firstname.lastname@example.org", name = "Alice Otieno", locale = "fr", roleId = "admin") # Add a user with a "Reporting Partner" role (rp) redcrossPartnerRecordId <- "ck5m79b9c2" addDatabaseUser(databaseId = "ck3pqrp9a1z", email = "email@example.com", name = "Bob", roleId = "rp", roleParameters = list(partner = redcrossPartnerRecordId))