Implement Hitobito deep-link UI
- Dominant language
- PHP
- Stars
- 156
- Forks
- 72
- Avg merge
- 12h 43m
- Merged PRs (30d)
- 203
Description
The *deep link* is a frontend link that allows navigating to a camp by a Hitobito id (for example: `https://app.ecamp3.ch/camps/hitobito//`).
As specified below, we check where the route the user (i.e. existing camp, camp import, not found screen) based on whether the event's camp exists already and whether the user has access to it.
Relevant Endpoints:
- https://github.com/ecamp/ecamp3/issues/10425
- https://github.com/ecamp/ecamp3/issues/10400
## Implementation
The user navigates to the page `/camps/hitobito//`.
Once the page loads:
1. Verify that the specified `provider` is valid (currently only `pbsmidata`)
1. Otherwise redirect to the 404 page
2. Query `GET /api/hitobito//events//camp`. Check the response:
- `403 Forbidden` with error type `/errors/hitobito-access-token-invalid`
- (hitobito access token is not set / invalid)
- Initialize OAuth as described here: https://github.com/ecamp/ecamp3/issues/10400 with the `callback=/camps/hitobito//`.
- `403 Forbidden` with error type `/errors/hitobito-camp-forbidden
- (camp exists, user does not have access)
- Redirect to the index page and show error `A camp exists for this event, but you don't have access to it. Please contact your camp administrator.`
- `403 Forbidden` with error type `/errors/hitobito-event-forbidden`
- (camp does not exist, Hitobito event exists, user does not have access to the Hitobito event)
- Redirect to the index page and show error `A Hitobito event was found, but you don't have permission to import it.`
- `404 Not Found` with error type `/errors/hitobito-camp-not-found`
- (camp does not exist, Hitobito event exists)
- Redirect to the import page `/camps/hitobito//import?eventId=` and proceed with the import flow: https://github.com/ecamp/ecamp3/issues/10401
- `404 Not Found` with error type `/errors/hitobito-event-not-found`
- (camp does not exist, Hitobito event does not exist)
- Redirect to the 404 page
- `200 OK`
- (camp exists, camp model is returned)
- Redirect to `/camps//`
- Any other error
- Redirect to index page and show a generic error
Contributor guide
Assessment
This issue has not been assessed yet.