fix: Default 组织下出现 app user

pull/5864/head
xinwen 2021-03-30 09:39:30 +08:00 committed by Jiangjie.Bai
parent 7d5a13de38
commit 6b5435b768
1 changed files with 5 additions and 0 deletions

View File

@ -90,6 +90,11 @@ class OrgMemberRelationBulkViewSet(JMSBulkRelationModelViewSet):
filterset_class = OrgMemberRelationFilterSet
search_fields = ('user__name', 'user__username', 'org__name')
def get_queryset(self):
queryset = super().get_queryset()
queryset = queryset.exclude(user__role=User.ROLE.APP)
return queryset
def perform_bulk_destroy(self, queryset):
objs = list(queryset.all().prefetch_related('user', 'org'))
queryset.delete()