Skip to main content

Assign the user to multiple User Groups

POST 

/groups-srv/usergroups/maps/:sub

This API call allows storing multiple user groups for one user, updating existing user groups, adding new ones and removing existing user groups if necessary.

Operation Modes:

  • insert: Adds new user group maps without affecting existing ones. If a user group map already exists, it will be skipped.
  • upsert: Updates existing user group maps or creates new ones if they don't exist. This is useful for updating roles for existing group memberships.
  • replaceAll: Replaces all user group memberships for the user with the provided list. All existing memberships not in the list will be removed.

Validation Rules:

  • instruction: Required, must be one of: "insert", "upsert", "replaceAll"
  • userGroupMaps: Required array, must contain at least one user group map
  • Each user group map must have:
    • sub: Required, must match the path parameter, must be a valid user ID
    • groupId: Required, must reference an existing user group
    • roles: Optional array, must comply with the group's groupType roleMode restrictions

Business Rules:

  • All user group maps in the array must reference the same sub (user ID) as specified in the path parameter.
  • When using replaceAll, ensure you include all desired group memberships, as any not included will be removed.
  • Role validation follows the same rules as individual user group map creation.
  • This operation is atomic - either all changes succeed or none are applied.

Request

Responses

OK