mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 01:38:50 -03:30
Copy credential bug - add owner too
While copying a credentials, we should set the new owner to person who copies it. There was a bug while trying to do so and this PR tries to address it. Link: #3750 Signed-off-by: Vismay Golwala <vgolwala@redhat.com>
This commit is contained in:
@@ -982,7 +982,7 @@ class CopyAPIView(GenericAPIView):
|
||||
None, None, self.model, obj, request.user, create_kwargs=create_kwargs,
|
||||
copy_name=serializer.validated_data.get('name', '')
|
||||
)
|
||||
if hasattr(new_obj, 'admin_role') and request.user not in new_obj.admin_role:
|
||||
if hasattr(new_obj, 'admin_role') and request.user not in new_obj.admin_role.members.all():
|
||||
new_obj.admin_role.members.add(request.user)
|
||||
if sub_objs:
|
||||
permission_check_func = None
|
||||
|
||||
Reference in New Issue
Block a user