From 2fb386b23c98689c2ef96dd5fc885af8264c0c64 Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Tue, 23 Aug 2016 09:55:00 -0400 Subject: [PATCH] allow users to edit their first and last name --- awx/api/views.py | 2 +- awx/main/tests/old/users.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/api/views.py b/awx/api/views.py index 201d40fe5d..a8abb6c8d3 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -1318,7 +1318,7 @@ class UserDetail(RetrieveUpdateDestroyAPIView): can_admin = request.user.can_access(User, 'admin', obj, request.data) su_only_edit_fields = ('is_superuser', 'is_system_auditor') - admin_only_edit_fields = ('last_name', 'first_name', 'username', 'is_active') + admin_only_edit_fields = ('username', 'is_active') fields_to_check = () if not request.user.is_superuser: diff --git a/awx/main/tests/old/users.py b/awx/main/tests/old/users.py index de364ff161..c581f8d592 100644 --- a/awx/main/tests/old/users.py +++ b/awx/main/tests/old/users.py @@ -325,9 +325,9 @@ class UsersTest(BaseTest): detail_url = reverse('api:user_detail', args=(self.other_django_user.pk,)) data = self.get(detail_url, expect=200, auth=self.get_other_credentials()) - # can't change first_name, last_name, etc + # can change first_name, last_name, etc data['last_name'] = "NewLastName" - self.put(detail_url, data, expect=403, auth=self.get_other_credentials()) + self.put(detail_url, data, expect=200, auth=self.get_other_credentials()) # can't change username data['username'] = 'newUsername'