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
Info and authentication for the requesting user
The operations attempted, whether they were successful and any errors
Function defined in packages/common/src/groups/add-users-workflow/add-users-to-group.ts:45