mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
920 B
31 lines
920 B
# -*- coding: utf-8 -*-
|
|
#
|
|
|
|
from rest_framework import generics
|
|
from rest_framework_bulk import BulkModelViewSet
|
|
from rest_framework.pagination import LimitOffsetPagination
|
|
|
|
from ..serializers import UserGroupSerializer, \
|
|
UserGroupUpdateMemberSerializer
|
|
from ..models import UserGroup
|
|
from common.permissions import IsOrgAdmin
|
|
from common.mixins import IDInFilterMixin
|
|
|
|
|
|
__all__ = ['UserGroupViewSet', 'UserGroupUpdateUserApi']
|
|
|
|
|
|
class UserGroupViewSet(IDInFilterMixin, BulkModelViewSet):
|
|
filter_fields = ("name",)
|
|
search_fields = filter_fields
|
|
queryset = UserGroup.objects.all()
|
|
serializer_class = UserGroupSerializer
|
|
permission_classes = (IsOrgAdmin,)
|
|
pagination_class = LimitOffsetPagination
|
|
|
|
|
|
class UserGroupUpdateUserApi(generics.RetrieveUpdateAPIView):
|
|
queryset = UserGroup.objects.all()
|
|
serializer_class = UserGroupUpdateMemberSerializer
|
|
permission_classes = (IsOrgAdmin,)
|