Fix permission check with incorrect object type
All checks were successful
Tests / test (push) Successful in 25s
All checks were successful
Tests / test (push) Successful in 25s
closes #119
This commit is contained in:
parent
b29ef95c89
commit
31f7ef9479
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,10 @@ import rules
|
|||
|
||||
|
||||
def has_organization_role(user, org, roles):
|
||||
from servala.core.models import Organization
|
||||
|
||||
if not isinstance(org, Organization):
|
||||
return False
|
||||
memberships = org.memberships.all().filter(user=user)
|
||||
if roles:
|
||||
memberships = memberships.filter(role__in=roles)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue