mirror of https://github.com/jumpserver/jumpserver
perf: 优化 console_orgs 的选择问题
parent
cfb1d306a3
commit
72362274ce
|
@ -152,13 +152,15 @@ class RoleBinding(JMSBaseModel):
|
|||
orgs = cls.orgs_order_by_name(orgs)
|
||||
workbench_perm = 'rbac.view_workbench'
|
||||
# 全局组织
|
||||
has_root_org = False
|
||||
root_org = Organization.root()
|
||||
if orgs and perm != workbench_perm and user.has_perm('orgs.view_rootorg'):
|
||||
root_org = Organization.root()
|
||||
orgs = [root_org, *list(orgs)]
|
||||
has_root_org = True
|
||||
elif orgs and perm == workbench_perm and user.has_perm('orgs.view_alljoinedorg'):
|
||||
# Todo: 先复用组织
|
||||
root_org = Organization.root()
|
||||
root_org.name = _("All organizations")
|
||||
root_org.name = _('All organizations')
|
||||
has_root_org = True
|
||||
|
||||
if has_root_org and system_bindings:
|
||||
orgs = [root_org, *list(orgs)]
|
||||
return orgs
|
||||
|
||||
|
|
Loading…
Reference in New Issue