Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Approval Node Edit Permissions #8253

Merged

Conversation

beeankha
Copy link
Contributor

SUMMARY

Currently, users with the proper org/wfjt admin permissions are unable to edit approval nodes in workflow job templates that they should have edit permissions for. This PR should fix that bug.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • API
AWX VERSION

ADDITIONAL INFORMATION

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

Copy link
Contributor

@ryanpetrello ryanpetrello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me, but I helped write it, so I'd say let's see what @AlanCoding thinks.

@@ -2750,6 +2750,9 @@ def can_add(self, data):
else:
return (self.check_related('workflow_approval_template', UnifiedJobTemplate, role_field='admin_role'))

def can_change(self, obj, data):
return self.user.can_access(WorkflowJobTemplate, 'change', obj.workflow_job_template, data=data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing data=data, I would much prefer data={}. The data you get contain fields for modification of the workflow approval template, not fields for the WFJT, which is how it would be interpreted in this call.

I'm also happy to take your word that the approval node's WFJT cannot be modified and cannot be null, so that this is not complicated further.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, data={} is probably what we want here.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 820d4d2 into ansible:devel Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants