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

How do I change the permission for a role rather than a user? #70

Open
vinyasmusic opened this issue Jun 24, 2017 · 1 comment
Open

Comments

@vinyasmusic
Copy link

vinyasmusic commented Jun 24, 2017

I have created two roles like this

class LevelOne(AbstractUserRole):
   available_permissions = {

       'view_details': True,
       'edit_details': True,
       'drop_tables': False,
       'edit_profile': False,
   }
class LevelTwo(AbstractUserRole):
   available_permissions = {

       'view_details': True,
       'edit_details': True,
       'drop_tables': True,
       'edit_profile': True,
   }

Now I want to be able to change the permission for either of the roles at will.
Suppose I want to set the permission edit_profile to True for LevelOne role.
How do I achieve that ?

@filipeximenes
Copy link
Contributor

Hi @vinyasmusic, despite allowing default permissions per role, permissions are actually managed in the user level. This means that assigning a role to a user will grant the initial set of default permissions but you are free to change the permissions while keeping the user role. Because of this we decided the library will not interfere with changes in the Role permissions. By doing this we avoid messing up someones system by accidentally granting a potentially sensitive permission. The way to do deal with it is write your own script updating the permissions. That way you can have full control of what is happening.

We should have this behaviour better documented. I'll keep this issue open until we do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants