Skip to content

Commit

Permalink
Merge pull request #6554 from wenottingham/this-may-be-what-alan-sugg…
Browse files Browse the repository at this point in the history
…ested

Allow disassociating orphaned users from credentials

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
  • Loading branch information
softwarefactory-project-zuul[bot] committed Apr 3, 2020
2 parents 82b1b85 + 4f32137 commit 99511de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions awx/api/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def post(self, request, *args, **kwargs):

credential_content_type = ContentType.objects.get_for_model(models.Credential)
if role.content_type == credential_content_type:
if role.content_object.organization and user not in role.content_object.organization.member_role:
if 'disassociate' not in request.data and role.content_object.organization and user not in role.content_object.organization.member_role:
data = dict(msg=_("You cannot grant credential access to a user not in the credentials' organization"))
return Response(data, status=status.HTTP_400_BAD_REQUEST)

Expand Down Expand Up @@ -4415,7 +4415,7 @@ def post(self, request, *args, **kwargs):

credential_content_type = ContentType.objects.get_for_model(models.Credential)
if role.content_type == credential_content_type:
if role.content_object.organization and user not in role.content_object.organization.member_role:
if 'disassociate' not in request.data and role.content_object.organization and user not in role.content_object.organization.member_role:
data = dict(msg=_("You cannot grant credential access to a user not in the credentials' organization"))
return Response(data, status=status.HTTP_400_BAD_REQUEST)

Expand Down

0 comments on commit 99511de

Please sign in to comment.