addUsersToGroup
Adds, invites or emails users about joining a group based on the permissions of the requesting user. The function returns a hash of results indicating which operations were attempted and whether they were successful.
In general, this algorithm will auto-add all the users that it can, invite the others, and send emails to eligible invited users (See below for more details)
Here are a couple caveats to be aware of:
- If the requestingUser can auto-add to the group (A.K.A. has portal:admin:assignToGroups) no email will be sent, period.
- Emails can only be sent to members of the same org as the requesting user if they have been invited (not auto-added) to the group. If emails must to be sent to invited members of a second org (e.g a community org), an authenticated user of the second org must be passed in (see secondaryRO)
- If no email is passed in, no email will be sent
- If auto-adding fails, the unadded users will be invited
Parameters
Parameter | Type | Default | Notes |
---|---|---|---|
groupId Required | string | ||
allUsers Required | IUser[] | ||
primaryRO Required | IHubRequestOptions |
Info and authentication for the requesting user |
|
email Optional | IEmail | ||
secondaryRO Optional | IHubRequestOptions |
Returns
The operations attempted, whether they were successful and any errors
Property | Type | Notes |
---|---|---|
boolean | ||
Optional | ISimpleResult | |
Optional | ICreateOrgNotificationResult | |
Optional | IInviteGroupUsersResult |
Function defined in common/src/groups/add-users-workflow/add-users-to-group.ts:46