Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RBAC] Add field to permission model to capture the service identifier #222

Open
AlanCoding opened this issue Mar 15, 2024 · 1 comment
Open
Labels
api API related item app:rbac code quality This item relates to code quality enhancement New feature or request

Comments

@AlanCoding
Copy link
Member

AlanCoding commented Mar 15, 2024

Part of the reason for introducing the DABPermission model was to do this work. This proposes to add a new field to that model which has a similar format as ResourceType.name. As the resource type name field is of format "{service}.{model}", this new field would be of format "{service}.{action}_{model}".

This would be an informative field for use by API clients. It will be logically commutable from the other fields and the resource registry. This has to be saved in the migration logic.

Tentatively, say this field is named full_name. Because name is taken.

The serializer for /api/v1/role_definitions/ will then use a SlugRelatedField with many=True and slug_field="full_name". This means that PermissionField will be deleted.

That will take "choices" away from the OPTIONS data, which implies/obligates us to add a new endpoint to provide options for permissions. The API design constraints related to that are complex, and is one thing that has prevented me from getting this done before now.

@AlanCoding AlanCoding added enhancement New feature or request api API related item code quality This item relates to code quality labels Mar 19, 2024
@AlanCoding
Copy link
Member Author

Saying this is an "enhancement" because it should allow query param filtering like /api/v1/role_definitions/?permissions__full_name=shared.view_organization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API related item app:rbac code quality This item relates to code quality enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant