mirror of https://github.com/jumpserver/jumpserver
[Bugfix] 解决进入授权详情页的资产管理页面bug
parent
98260b5b52
commit
003601bbdd
|
@ -96,6 +96,14 @@ class AssetPermission(BasePermission):
|
|||
def get_queryset_with_prefetch(cls):
|
||||
return cls.objects.all().valid().prefetch_related('nodes', 'assets', 'system_users')
|
||||
|
||||
def get_all_assets(self):
|
||||
assets = set(self.assets.all())
|
||||
for node in self.nodes.all():
|
||||
_assets = node.get_all_assets()
|
||||
set_or_append_attr_bulk(_assets, 'inherit', node.value)
|
||||
assets.update(set(_assets))
|
||||
return assets
|
||||
|
||||
|
||||
class NodePermission(OrgModelMixin):
|
||||
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
||||
|
|
|
@ -156,7 +156,7 @@ class AssetPermissionAssetView(PermissionsMixin,
|
|||
permission_classes = [IsOrgAdmin]
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
self.object = self.get_object(queryset = AssetPermission.objects.all())
|
||||
self.object = self.get_object(queryset=AssetPermission.objects.all())
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
|
|
Loading…
Reference in New Issue