Service instance edit and delete permissions tied to Django permissions #131
Labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: servala/servala-portal#131
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Looking at the code (https://servala.app.codey.ch/servala/servala-portal/src/branch/main/src/servala/frontend/views/service.py#L222-L227) and if I understand it correctly, the "has_change_permission" and "has_delete_permission" checks are tied to the Django permission system. This is suboptimal, as we don't specifically give permissions to user.
Change
Change these checks so that a member of the organization the service instance belongs to with the "Owner" or "Administrator" role has change and delete permission.
The permissions should be using django-rules – we use the idiomatic
User.has_perm()
which delegates to auth frameworks like django-rules. We currently set the model permission rules in therules_permissions
field on theModel.Meta
class for organizations and for service instances.I opened #151, which restricts permissions as indicated in the other PR, but also makes a change so that staff users can use the admin interface (which they technically were able to already – given URLs to objects. However, the dashboard with the initial object links was hidden from them due to the missing permission rule).