fix: 全局组织受权限位控制

pull/7876/head
Jiangjie.Bai 2022-03-16 11:25:42 +08:00 committed by 老广
parent d320443c9f
commit 5ec970fab4
1 changed files with 3 additions and 1 deletions

View File

@ -783,9 +783,11 @@ class User(AuthMixin, TokenMixin, RoleMixin, MFAMixin, AbstractUser):
.exclude(name=BuiltinRole.system_user.name)\
.exists()
if has_system_role:
orgs = [Organization.root()] + list(Organization.objects.all())
orgs = list(Organization.objects.all())
else:
orgs = list(self.orgs.all().distinct())
if self.has_perm('orgs.view_rootorg'):
orgs = [Organization.root()] + orgs
return orgs
class Meta: