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)
|
orgs = cls.orgs_order_by_name(orgs)
|
||||||
workbench_perm = 'rbac.view_workbench'
|
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'):
|
if orgs and perm != workbench_perm and user.has_perm('orgs.view_rootorg'):
|
||||||
root_org = Organization.root()
|
has_root_org = True
|
||||||
orgs = [root_org, *list(orgs)]
|
|
||||||
elif orgs and perm == workbench_perm and user.has_perm('orgs.view_alljoinedorg'):
|
elif orgs and perm == workbench_perm and user.has_perm('orgs.view_alljoinedorg'):
|
||||||
# Todo: 先复用组织
|
root_org.name = _('All organizations')
|
||||||
root_org = Organization.root()
|
has_root_org = True
|
||||||
root_org.name = _("All organizations")
|
|
||||||
|
if has_root_org and system_bindings:
|
||||||
orgs = [root_org, *list(orgs)]
|
orgs = [root_org, *list(orgs)]
|
||||||
return orgs
|
return orgs
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue