Skip to main content

Groups

note

This guide assumes familiarity with the Spring Framework.
If you are new to Spring, we recommend starting with their official guides to get up to speed.

Groups allow fine-grained control on which information each user is allowed to see.

note

You can learn more on how to secure endpoints by requiring a group membership here.

A Group is uniquely identified by a key. You can save a name and a description in multiple translations to the database.

info

Managing groups and their members can only be done by users with the ADMIN role.

Managing Groups

Group Keys

The group's key cannot be changed once created. This is necessary to maintain consistency in the database.

contributor

The contributor group will always be included by default. This group is necessary for managing content. You can learn more here.

Creating Groups

You can create a new group with a key, and translations of name and descriptions through the endpoint POST /api/groups.

Getting Groups

You can retrieve all configured groups through the endpoint GET /api/groups. If you need one specific group, you can retrieve information about it using the group's key through the endpoint GET /api/groups/{key}.

Updating Groups

You can update a group through the endpoint PUT /api/groups/{key}.

Deleting Groups

You can delete a group through the endpoint DELETE /api/groups/{key}.

Managing Members

Adding Members to Groups

You can add a member to a group through the endpoint POST /api/groups/{key}/members.

This will invalidate all AccessTokens for the new member. This way, before performing a new request for the new member, a new token needs to be requested from POST /api/auth/refresh. The new token will contain the new group membership.

Removing Members from Groups

You can remove a member from a group through the endpoint DELETE /api/groups/{key}/members.

This will invalidate all AccessTokens for the removed member. This way, before performing a new request for the new member, a new token needs to be requested from POST /api/auth/refresh. The new token will contain the revoke the group membership.

Configuration

You can configure groups to be available after the first application startup.

PropertyTypeDescriptionDefault
singularity.app.groupsList<CreateGroupRequest>Groups that will be created on application startup.
singularity:
app:
groups:
- key: pilots # the unique key
translations: # translations containing name and description
- en:
name: Pilots
description: The pilots of our mission.
- de:
name: Piloten
description: Die Piloten unserer Mission.
- key: passenger
translations:
- en:
name: Passenger
description: The passengers of our mission.
- de:
name: Passagiere
description: Die passagiere unserer Mission.