fixed a few issues related to approval role RBAC for normal users

This commit is contained in:
Ryan Petrello
2019-08-06 11:26:14 -04:00
parent 28289e85c1
commit 0522d45ab0
8 changed files with 36 additions and 6 deletions

View File

@@ -2799,9 +2799,11 @@ class WorkflowApprovalAccess(BaseAccess):
def get_queryset(self):
return super(WorkflowApprovalAccess, self).get_queryset().exclude(
workflow_approval_template__isnull=False)
workflow_approval_template__isnull=True)
def can_approve_or_deny(self, obj):
if obj.status != 'pending':
return False
wfjt = obj.unified_job_node.workflow_job.unified_job_template
if self.user in wfjt.approval_role or self.user.is_superuser:
return True