Browse Source

fix: 修改rbac permission

pull/7896/head
feng626 3 years ago committed by Jiangjie.Bai
parent
commit
dfe5e2bce3
  1. 5
      apps/rbac/permissions.py

5
apps/rbac/permissions.py

@ -66,8 +66,10 @@ class RBACPermission(permissions.DjangoModelPermissions):
perms = {}
if hasattr(view, 'rbac_perms'):
perms.update(dict(view.rbac_perms))
default_perms = self.get_default_action_perms(model_cls)
if '*' not in perms:
perms.update(self.get_default_action_perms(model_cls))
for k, v in default_perms.items():
perms.setdefault(k, v)
return perms
def _get_action_perms(self, action, model_cls, view):
@ -107,6 +109,7 @@ class RBACPermission(permissions.DjangoModelPermissions):
if not action:
action = request.method
perms = self._get_action_perms(action, model_cls, view)
print(model_cls, perms, action)
return perms
def has_permission(self, request, view):

Loading…
Cancel
Save