-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix object-level permission bugs with DAB RBAC system (#15284)
* Fix object-level permission bugs with DAB RBAC system * Fix NT organization change regression * Mark tests to AAP number
- Loading branch information
1 parent
13dcea0
commit 4738c83
Showing
5 changed files
with
36 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
awx/main/tests/functional/dab_rbac/test_access_regressions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest | ||
|
||
from awx.main.access import InstanceGroupAccess, NotificationTemplateAccess | ||
|
||
from ansible_base.rbac.models import RoleDefinition | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_instance_group_object_role_delete(rando, instance_group, setup_managed_roles): | ||
"""Basic functionality of IG object-level admin role function AAP-25506""" | ||
rd = RoleDefinition.objects.get(name='InstanceGroup Admin') | ||
rd.give_permission(rando, instance_group) | ||
access = InstanceGroupAccess(rando) | ||
assert access.can_delete(instance_group) | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_notification_template_object_role_change(rando, notification_template, setup_managed_roles): | ||
"""Basic functionality of NT object-level admin role function AAP-25493""" | ||
rd = RoleDefinition.objects.get(name='NotificationTemplate Admin') | ||
rd.give_permission(rando, notification_template) | ||
access = NotificationTemplateAccess(rando) | ||
assert access.can_change(notification_template, {'name': 'new name'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters