mirror of https://github.com/jumpserver/jumpserver
parent
79994f5ddc
commit
3222687aaa
|
@ -23,6 +23,8 @@ __all__ = [
|
||||||
|
|
||||||
|
|
||||||
class RelationMixin(OrgRelationMixin, OrgBulkModelViewSet):
|
class RelationMixin(OrgRelationMixin, OrgBulkModelViewSet):
|
||||||
|
perm_model = models.ApplicationPermission
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
queryset = super().get_queryset()
|
queryset = super().get_queryset()
|
||||||
org_id = current_org.org_id()
|
org_id = current_org.org_id()
|
||||||
|
@ -86,8 +88,8 @@ class ApplicationPermissionSystemUserRelationViewSet(RelationMixin):
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
queryset = super().get_queryset()
|
queryset = super().get_queryset()
|
||||||
queryset = queryset \
|
queryset = queryset.annotate(
|
||||||
.annotate(systemuser_display=Concat(
|
systemuser_display=Concat(
|
||||||
F('systemuser__name'), Value('('), F('systemuser__username'),
|
F('systemuser__name'), Value('('), F('systemuser__username'),
|
||||||
Value(')')
|
Value(')')
|
||||||
))
|
))
|
||||||
|
@ -103,7 +105,7 @@ class ApplicationPermissionAllApplicationListApi(generics.ListAPIView):
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
pk = self.kwargs.get('pk')
|
pk = self.kwargs.get('pk')
|
||||||
perm = get_object_or_404(models.ApplicationPermission, pk=pk)
|
perm = get_object_or_404(models.ApplicationPermission, pk=pk)
|
||||||
applications = Application.objects.filter(granted_by_permissions=perm)\
|
applications = Application.objects.filter(granted_by_permissions=perm) \
|
||||||
.only(*self.only_fields).distinct()
|
.only(*self.only_fields).distinct()
|
||||||
return applications
|
return applications
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue