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

Can coexist with django-guardian and django-groups-manager? #77

Open
Allan-Nava opened this issue Dec 14, 2017 · 2 comments
Open

Can coexist with django-guardian and django-groups-manager? #77

Allan-Nava opened this issue Dec 14, 2017 · 2 comments

Comments

@Allan-Nava
Copy link

Hi,

I need to implement the permission with a general role for a specific group, like staff group that handle the group.

I explain the example:

from football.models import TeamBudget
from groups_manager.models import Group, Member

fc_internazionale = Group.objects.create(name='F.C. Internazionale Milan')
staff = Group.objects.create(name='Staff', parent=fc_internazionale)
players = Group.objects.create(name='Players', parent=fc_internazionale)
thohir = Member.objects.create(first_name='Eric', last_name='Thohir')
staff.add_member(thohir)
palacio = Member.objects.create(first_name='Rodrigo', last_name='Palacio')
players.add_member(palacio)
small_budget = TeamBudget.objects.create(euros='1000')
thohir.assign_object(staff, small_budget)
thohir.has_perm('change_teambudget', small_budget)  # True
palacio.has_perm('change_teambudget', small_budget)  # False
# or via group
mid_budget = TeamBudget.objects.create(euros='3000')
staff.assign_object(mid_budget)
thohir.has_perm('change_teambudget', mid_budget)  # True
palacio.has_perm('change_teambudget', mid_budget)  # False

The staff member can handle the group and group descendent
Is possible to implement?

@filipeximenes
Copy link
Contributor

Hey, I'm not sure I understood your question, but django-role-permissions does not knows how to deal with subgroups.
It's very good to manage generic concepts like staff and player roles but to be able to deal with per team permissions you will need object level checkers (https://django-role-permissions.readthedocs.io/en/stable/object_permissions.html).

@Allan-Nava
Copy link
Author

@felipefarias Ok, I use this library: django-groups-manager but it depends to django-guardian

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