dfunckt / django-rules

Awesome Django authorization, without the database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using group permissions and rules

felipeacunago opened this issue · comments

Hi guys, how can I create a rule that works like the default group permission system?, as the rules library overrides the default permissions backend I don't know how to access Permissions object because of course the has_perm method doesn't consider the Permissions.

I don't want to use is_group_member, as I don't want to explicitly tell the app the name of the group.

What I'm trying to achieve is recreating a rule that works like the old has_perm for groups permissions.
This because I want to use a custom rule in addition to the default system.

Thanks!

as the rules library overrides the default permissions backend

Not sure I fully understand what the issue is but this reads to me as inaccurate. The rules auth backend is typically being used in addition to the default backend, see here: https://github.com/dfunckt/django-rules#checking-for-permission (you'll need to scroll down a bit to the code snippet that sets the AUTHENTICATION_BACKENDS setting).

as the rules library overrides the default permissions backend

Not sure I fully understand what the issue is but this reads to me as inaccurate. The rules auth backend is typically being used in addition to the default backend, see here: https://github.com/dfunckt/django-rules#checking-for-permission (you'll need to scroll down a bit to the code snippet that sets the AUTHENTICATION_BACKENDS setting).

Sorry, you are right, I was using RulesModel with the same permission names as the default ones, so I wasn't able to get the group permissions.

Thanks!, Just got it working now :)