|
16 | 16 |
|
17 | 17 | from openedx_authz import ROOT_DIRECTORY |
18 | 18 | from openedx_authz.constants import roles |
19 | | -from openedx_authz.engine.matcher import check_custom_conditions |
| 19 | +from openedx_authz.engine.matcher import is_admin_or_superuser_check |
20 | 20 | from openedx_authz.tests.test_utils import ( |
21 | 21 | make_action_key, |
22 | 22 | make_library_key, |
@@ -71,7 +71,7 @@ def setUpClass(cls) -> None: |
71 | 71 | raise FileNotFoundError(f"Model file not found: {model_file}") |
72 | 72 |
|
73 | 73 | cls.enforcer = casbin.Enforcer(model_file) |
74 | | - cls.enforcer.add_function("custom_check", check_custom_conditions) |
| 74 | + cls.enforcer.add_function("is_staff_or_superuser", is_admin_or_superuser_check) |
75 | 75 |
|
76 | 76 | def _load_policy(self, policy: list[str]) -> None: |
77 | 77 | """ |
@@ -586,10 +586,10 @@ def test_wildcard_library_access(self, scope: str, expected_result: bool): |
586 | 586 | @ddt |
587 | 587 | class StaffSuperuserAccessTests(CasbinEnforcementTestCase): |
588 | 588 | """ |
589 | | - Tests for staff and superuser automatic permission grants via custom_check. |
| 589 | + Tests for staff and superuser automatic permission grants via is_staff_or_superuser. |
590 | 590 |
|
591 | 591 | This test class verifies that staff members and superusers are automatically |
592 | | - granted access to ContentLibrary scopes through the check_custom_conditions function, |
| 592 | + granted access to ContentLibrary scopes through the is_admin_or_superuser_check function, |
593 | 593 | without requiring explicit role assignments. |
594 | 594 | """ |
595 | 595 |
|
@@ -646,7 +646,7 @@ def test_staff_superuser_guaranteed_permissions(self, subject: str, action: str, |
646 | 646 | - Staff users automatically have access to all library scopes without role assignments |
647 | 647 | - Superusers automatically have access to all library scopes without role assignments |
648 | 648 | - Regular users require explicit role assignments to access libraries |
649 | | - - Access is granted through the custom_check matcher function |
| 649 | + - Access is granted through the is_staff_or_superuser matcher function |
650 | 650 |
|
651 | 651 | Expected result: |
652 | 652 | - Staff and superusers can perform any action on any ContentLibrary scope |
|
0 commit comments