This is a shared access control flow, used by multiple endpoints, to check whether a user has access to a Hitobito event they are trying to access.
Implementation
- Retrieve event participations from the Hitobito API, filtering by the specified event id, and the user id
GET <base-url>/api/event_participations
?include=roles
&filter[participant_id][eq]=<hitobito_user_id>
&filter[event_id][eq]=<eventId>
&fields[event_participations]=active
&fields[event_roles]=type
Example Response:
- Make sure that one of the included roles has one of the following
attributes.type
Event::Camp::Role::Leader
Event::Role::Leader
Event::Course::Role::Leader
- If no event / event participations are found, respond with
404 Not Found
- If an event is found but the role is not present or the participation has
active = false, respond with 403 Forbidden
Implementation Note: Make sure that the role that identifies a user as a leader of an event (for MiData Event::Camp::Role::Leader) is configurable per different Hitobito provider, so that new supported instances (i.e. CeviDB) can be easily added in the future.
Defined roles should be shared with #10386
This is a shared access control flow, used by multiple endpoints, to check whether a user has access to a Hitobito event they are trying to access.
Implementation
{ "data": [ { "id": "16904", "type": "event_participations", "attributes": { "active": true }, "relationships": { // ... "roles": { "data": [ { "type": "event_roles", "id": "17996" } ] } } } ], "included": [ { "id": "17996", "type": "event_roles", "attributes": { "type": "Event::Camp::Role::Leader" }, "relationships": { "participation": { "meta": { "included": false } } } } ], "links": { /* ... */ }, "meta": {} }attributes.typeEvent::Camp::Role::LeaderEvent::Role::LeaderEvent::Course::Role::Leader404 Not Foundactive = false, respond with403 Forbidden