Repository navigation
Description
Why?
FOCA-based services have owner-based access control, starting with cloud-registry 0.4.0 (elixir-cloud-aai/cloud-registry#62, elixir-cloud-aai/cloud-registry#106, elixir-cloud-aai/cloud-registry#129). Whoever creates a resource becomes its owner. Owners grant users (by user ID, the token's sub) or groups (a value of the deployment's group claim) the roles owner or maintainer:
GET /services/{id}/permissionslists users ({user_id, name?, role}) and groups ({group, role}) together.PUT/DELETE /services/{id}/permissions/{userId}grants (body{"role": ...}) and revokes a user's role.PUT/DELETE /services/{id}/permissions/groups/{group}does the same for a group (URL-encoded). Owners may grant roles only to groups they are members of (403), admins to any group.- Removing or downgrading the last owner returns
409.
No component covers this. The Cloud Registry UI builds a "Manage access" dialog of its own (elixir-cloud-aai/cloud-registry-ui#16). It is shaped to be moved here later:
- List: users and groups with a role select and remove.
- Grant form: user or group, ID, role.
- Messages: for
409and403, and a warning against granting roles to broad groups, because all members of an owner group can manage the resource. - Inputs: a provider, a resource ID and an optional current user ID. It emits a change event.
#449 describes the layering: GA4GH Service Registry components, Cloud Registry components, and components for features that all FOCA apps share, such as /me and the permissions endpoints. This issue is the permissions part of that last group; #449 covers /me.
What?
- Add permissions methods and types to the provider: list, grant and revoke for users and groups. Use the same shared FOCA provider layer as
getMe()in feat(cloud-registry): add getMe() for FOCA's /me #449, so other FOCA apps can use them with their own resource paths (e.g./services,/tasks). - Add a permissions component (e.g.
ecc-client-foca-permissions) with aresource-idproperty:- It lists, grants and revokes user and group roles.
- It shows the API's problem details. It has its own messages for the last owner (
409) and for groups the user isn't a member of (403), and warns against broad groups. - It emits events for changes and failures, carrying the status (cf. feat(cloud-registry): expose problem details on errors #454).
- Optional: a small "your user ID" component with a copy button, so users can send their ID to an owner.
Acceptance criteria
- An app can let owners and admins list, grant and revoke user and group roles on a resource with the component, without its own dialog.
Notes: granting by user ID is clumsy. Invitation links would help once elixir-cloud-aai/cloud-registry#101 is implemented.
Activity