fix: 修复登录资产ACL会获取所有组织下数据的问题

pull/9432/head
Bai 2 years ago committed by Jiangjie.Bai
parent 91357b3715
commit 4960c4b260

@ -62,11 +62,15 @@ class UserAssetAccountACLQuerySet(BaseACLQuerySet):
return self.filter(q) return self.filter(q)
class ACLManager(OrgManager): class ACLManager(models.Manager):
def valid(self): def valid(self):
return self.get_queryset().valid() return self.get_queryset().valid()
class OrgACLManager(OrgManager, ACLManager):
pass
class BaseACL(JMSBaseModel): class BaseACL(JMSBaseModel):
name = models.CharField(max_length=128, verbose_name=_('Name')) name = models.CharField(max_length=128, verbose_name=_('Name'))
priority = models.IntegerField( priority = models.IntegerField(
@ -97,7 +101,7 @@ class UserAssetAccountBaseACL(BaseACL, OrgModelMixin):
# username_group # username_group
accounts = models.JSONField(verbose_name=_('Account')) accounts = models.JSONField(verbose_name=_('Account'))
objects = ACLManager.from_queryset(UserAssetAccountACLQuerySet)() objects = OrgACLManager.from_queryset(UserAssetAccountACLQuerySet)()
class Meta(BaseACL.Meta): class Meta(BaseACL.Meta):
unique_together = ('name', 'org_id') unique_together = ('name', 'org_id')

Loading…
Cancel
Save