-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add rolespermissions module, refractor the group and delete submission to use it #4151
Conversation
2e0e926
to
7c483c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice no changes at all in how Hypha works so that is good. Running the "sync_roles" does not add/delete/change any of the existing roles. Deleting an existing role and running "sync_roles" restores it.
On another thought, let's hold on to merging this, I'm reading and trying out few things with some of the use-cases we have the project and make a final decision on going with esp. i'm evaluating Looking at the use case, hypha seems to have majority object level permissions. |
c950367
to
f2cf4df
Compare
f2cf4df
to
b81616f
Compare
Update how initial groups are created in the database, instead of putting them in the migration files, which is quite hard to maintain the group definitation is now maintained via the AbstractRoles and they rsync'ed using `python manage.py sync_roles`. It will never delete any existing group or permissions attached to them. This PR also updates the `hypha.apply.users.groups` module to `hypha.apply.users.roles` to better prepare of upcoming changes due to rolepermissions module
6d06e6a
to
df6125f
Compare
Implemented a sample permission and it's checks for the delete submissions, it looks straightforward. I was not confident that the |
@frjo @sandeepsajan0 @wes-otf If the delete submission implementation looks good, let's try get this merged so rest of the followup PRs will be mostly converting existing permission check to use the |
b10c664
to
63801da
Compare
63801da
to
8239c21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A failing test to fix. I also think we need to add the sync_roles
to the Procfile
so it runs on Heroku deployments.
Update the test to match new test settings where
This should covered already, let me know if you face issue when deploying this branch. |
Updates group management:
Centralized Group Definition: Instead of creating groups within migration files, which can be cumbersome to maintain, group definitions are now managed through the AbstractRoles model. These roles are synchronized using the
python manage.py sync_roles
command. This ensures no existing groups or their associated permissions are deleted.Module Renaming: The
hypha.apply.users.groups
module has been renamed tohypha.apply.users.roles
to reflect the shift from group-based to role-based permissions. This aligns with upcoming changes utilizing therolepermissions
module.Streamlined Group Descriptions: The GroupDesc model is removed. Instead, help text can be directly defined within the role itself. This simplifies management and allows for translation of group descriptions.
This is the first of a series of pull requests aimed at refactoring the permissions system.
As a sample implementation, converts the delete submission to use this role-permissions. See: 8239c21
Test Steps
python manage.py sync_roles
, it should also keep the existing groups.