mirror of
https://github.com/ansible/awx.git
synced 2026-09-04 19:08:30 -02:30
RBAC relaunch 403 updates (#3835)
* RBAC relaunch 403 updates Addresses 2 things 1. If WFJ relaunch is attempted, and relaunch is denied because the WFJ had encrypted survey answers, a generic message was shown, this changes it to show a specific error message 2. Org admins are banned from relaunching a job if the job has encrypted survey answers * update tests to raises access pattern * catch PermissionDenied for user_capabilities
This commit is contained in:
committed by
Ryan Petrello
parent
a0fb9bef3a
commit
3f49d2c455
@@ -19,6 +19,8 @@ from awx.main.models import (
|
||||
Credential
|
||||
)
|
||||
|
||||
from rest_framework.exceptions import PermissionDenied
|
||||
|
||||
from crum import impersonate
|
||||
|
||||
|
||||
@@ -252,7 +254,8 @@ class TestJobRelaunchAccess:
|
||||
|
||||
assert 'job_var' in job.launch_config.extra_data
|
||||
assert bob.can_access(Job, 'start', job, validate_license=False)
|
||||
assert not alice.can_access(Job, 'start', job, validate_license=False)
|
||||
with pytest.raises(PermissionDenied):
|
||||
alice.can_access(Job, 'start', job, validate_license=False)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
@@ -7,6 +7,8 @@ from awx.main.access import (
|
||||
# WorkflowJobNodeAccess
|
||||
)
|
||||
|
||||
from rest_framework.exceptions import PermissionDenied
|
||||
|
||||
from awx.main.models import InventorySource, JobLaunchConfig
|
||||
|
||||
|
||||
@@ -169,7 +171,8 @@ class TestWorkflowJobAccess:
|
||||
wfjt.ask_inventory_on_launch = True
|
||||
wfjt.save()
|
||||
JobLaunchConfig.objects.create(job=workflow_job, inventory=inventory)
|
||||
assert not WorkflowJobAccess(rando).can_start(workflow_job)
|
||||
with pytest.raises(PermissionDenied):
|
||||
WorkflowJobAccess(rando).can_start(workflow_job)
|
||||
inventory.use_role.members.add(rando)
|
||||
assert WorkflowJobAccess(rando).can_start(workflow_job)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user