mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 19:07:39 -02:30
remove duplicate BaseUsersList
This commit is contained in:
@@ -18,7 +18,7 @@ import six
|
|||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import FieldError, ObjectDoesNotExist
|
from django.core.exceptions import FieldError, ObjectDoesNotExist
|
||||||
from django.db.models import Q, Count
|
from django.db.models import Q
|
||||||
from django.db import IntegrityError, transaction, connection
|
from django.db import IntegrityError, transaction, connection
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_text
|
||||||
|
|||||||
@@ -134,25 +134,6 @@ class OrganizationInventoriesList(SubListAPIView):
|
|||||||
relationship = 'inventories'
|
relationship = 'inventories'
|
||||||
|
|
||||||
|
|
||||||
class BaseUsersList(SubListCreateAttachDetachAPIView):
|
|
||||||
def post(self, request, *args, **kwargs):
|
|
||||||
ret = super(BaseUsersList, self).post( request, *args, **kwargs)
|
|
||||||
if ret.status_code != 201:
|
|
||||||
return ret
|
|
||||||
try:
|
|
||||||
if ret.data is not None and request.data.get('is_system_auditor', False):
|
|
||||||
# This is a faux-field that just maps to checking the system
|
|
||||||
# auditor role member list.. unfortunately this means we can't
|
|
||||||
# set it on creation, and thus needs to be set here.
|
|
||||||
user = User.objects.get(id=ret.data['id'])
|
|
||||||
user.is_system_auditor = request.data['is_system_auditor']
|
|
||||||
ret.data['is_system_auditor'] = request.data['is_system_auditor']
|
|
||||||
except AttributeError as exc:
|
|
||||||
print(exc)
|
|
||||||
pass
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
class OrganizationUsersList(BaseUsersList):
|
class OrganizationUsersList(BaseUsersList):
|
||||||
|
|
||||||
model = User
|
model = User
|
||||||
|
|||||||
Reference in New Issue
Block a user