Skip to main content

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) and groupId (must match the path parameter).
  • Optionally, you can specify roles array 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 roles array to add or remove roles for the user in this group.
  • The sub and groupId cannot be changed (they identify the specific user-group relationship).

Validation Rules:

  • sub: Required, must be a valid user ID (UUID format), user must exist
  • groupId: Required, must match the path parameter, must reference an existing user group
  • roles: 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's allowedRoles can be assigned.
  • If the group's groupType has roleMode: no_roles, the roles array 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

OK - User group map updated successfully