Add or update user group map
POST/groups-srv/usergroups/:groupId/users
This API call adds a user to user group or updates the user group map.
Creating a new user group map:
- You must specify
sub(user ID) andgroupId(must match the path parameter). - Optionally, you can specify
rolesarray to assign roles to the user in this group. - The user must exist in the system.
- The group must exist and be accessible.
Updating an existing user group map:
- You can update the
rolesarray to add or remove roles for the user in this group. - The
subandgroupIdcannot be changed (they identify the specific user-group relationship).
Validation Rules:
sub: Required, must be a valid user ID (UUID format), user must existgroupId: Required, must match the path parameter, must reference an existing user grouproles: Optional array, all roles must:- Exist in the system
- Be allowed by the group's groupType configuration (if groupType has
roleMode: allowed_roles) - Be valid role names (case-sensitive)
Business Rules:
- If the group's groupType has
roleMode: allowed_roles, only roles listed in the groupType'sallowedRolescan be assigned. - If the group's groupType has
roleMode: no_roles, therolesarray must be empty or omitted. - If the group's groupType has
roleMode: any_roles, any valid role can be assigned. - Users can be members of multiple groups simultaneously.
- The same user can have different roles in different groups.
Request
Responses
- 200
- 201
- 401
- 417
OK - User group map updated successfully
Created - New user group map created successfully
Unauthorized - Authentication failed or missing required scope
Expectation Failed - Validation failed (e.g., invalid roles, non-existent group, or user not found)