Merge branch 'v3' of github.com:jumpserver/jumpserver into v3

pull/8970/head
ibuler 2022-10-14 16:34:14 +08:00
commit 37d845390b
1 changed files with 13 additions and 2 deletions

View File

@ -129,8 +129,19 @@ class AssetPermission(OrgModelMixin):
return assets
def get_all_accounts(self):
""" TODO: 获取所有账号 (Account 对象) """
pass
"""
:return: 返回授权的所有账号对象 Account
"""
asset_ids = self.get_all_assets(flat=True)
q = Q(asset_id__in=asset_ids)
if not self.is_perm_all_accounts:
q &= Q(username__in=self.accounts)
accounts = Account.objects.filter(q)
return accounts
@property
def is_perm_all_accounts(self):
return SpecialAccount.ALL in self.accounts
@lazyproperty
def users_amount(self):