Repository navigation
RESTHeart 9.19.0
A team membership can now carry the application's own roles, next to owner and member, and ACL rules read them. The OAuth login records the user's language, so that the later emails reach them in it.
appRoles: application roles in a team membership (#833)
A membership has one role, owner or member. An application often needs roles of its own inside a team: a project manager, a reviewer, a billing contact. They go in appRoles, an array of names next to role. restheart-accounts stores them and gives them to ACL rules; it does not interpret them.
An owner sets them with PATCH /auth/member-role, which replaces the member's application roles; [] removes them. role and appRoles are each optional, one is required:
{ "email": "bob@example.com", "appRoles": ["manager", "reviewer"] }An invitation can carry them too: POST /auth/invite with appRoles, which the member gets on acceptance.
| Variable | Value |
|---|---|
@team.appRoles |
the caller's application roles in the active team, always an array |
@teams.<appRole> |
the ids of the teams where the caller has that application role, e.g. @teams.manager |
Only a manager of the active team can insert, and reads see the documents of the teams where the caller is a manager:
in(value='manager', array=@team.appRoles)
{ "readFilter": { "team": { "$in": "@teams.manager" } } }A change is seen by the next request, with the same token. A name cannot be blank, contain . or start with $, and cannot be _id, the ownership-role or the member-role-name, so that @teams.<name> is never ambiguous; anything else is refused with 400.
appRoles is returned by GET /auth/teams, POST /auth/switch-team, GET /auth/team/members, GET /auth/invitations and GET /auth/invitation, an empty array when there are none. @team and @teams are now { _id, role, appRoles }.
For custom membership providers: MembershipProvider.updateMemberAppRoles and addMember(userId, teamId, role, appRoles), both with a default implementation; Membership and TeamMember have an appRoles component and keep their previous constructors.
The OAuth login records the user's language (#834)
Since 9.17.1 a registration and an invitation store the user's locale, the language of their emails. The OAuth login now does too: the locale query parameter of GET /auth/oauth/authorize/{provider} when the frontend sends one, else the first language of the browser's Accept-Language, reduced to its main part (it-IT gives it). The authorize URL is opened by the browser itself, so the frontend needs to send nothing.
The language is written only on a user who has none: a language the user chose always wins. A locale that is not a language code ends the flow at frontend-error-url. If the users collection's JSON Schema refuses locale, the language is not written and the login goes on.
Packages
- Docker:
softinstigate/restheart:9.19.0 - Maven:
org.restheart:restheart-commons:9.19.0and the other modules, on Maven Central.