mirror of https://github.com/jumpserver/jumpserver
fix: 修复用户绑定角色重大bug
parent
a1976e4f0b
commit
ddbcbb0d66
|
@ -237,16 +237,16 @@ class RoleManager(models.Manager):
|
||||||
|
|
||||||
class OrgRoleManager(RoleManager):
|
class OrgRoleManager(RoleManager):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
|
||||||
from rbac.const import Scope
|
from rbac.const import Scope
|
||||||
self.scope = Scope.org
|
self.scope = Scope.org
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class SystemRoleManager(RoleManager):
|
class SystemRoleManager(RoleManager):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
|
||||||
from rbac.const import Scope
|
from rbac.const import Scope
|
||||||
self.scope = Scope.system
|
self.scope = Scope.system
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class RoleMixin:
|
class RoleMixin:
|
||||||
|
|
|
@ -49,6 +49,8 @@ class RolesSerializerMixin(serializers.Serializer):
|
||||||
return fields
|
return fields
|
||||||
|
|
||||||
action = view.action or 'list'
|
action = view.action or 'list'
|
||||||
|
if action in ('partial_bulk_update', 'bulk_update', 'partial_update', 'update'):
|
||||||
|
action = 'create'
|
||||||
model_cls_field_mapper = {
|
model_cls_field_mapper = {
|
||||||
SystemRoleBinding: ['system_roles', 'system_roles_display'],
|
SystemRoleBinding: ['system_roles', 'system_roles_display'],
|
||||||
OrgRoleBinding: ['org_roles', 'system_roles_display']
|
OrgRoleBinding: ['org_roles', 'system_roles_display']
|
||||||
|
|
Loading…
Reference in New Issue