Skip to content

Commit cf2fa62

Browse files
refactor: change generic to global wildecard constant
1 parent 685ebb1 commit cf2fa62

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

openedx_authz/api/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
AUTHZ_POLICY_ATTRIBUTES_SEPARATOR = "^"
3333
EXTERNAL_KEY_SEPARATOR = ":"
34-
GENERIC_SCOPE_WILDCARD = "*"
34+
GLOBAL_SCOPE_WILDCARD = "*"
3535
NAMESPACED_KEY_PATTERN = rf"^.+{re.escape(AUTHZ_POLICY_ATTRIBUTES_SEPARATOR)}.+$"
3636

3737

@@ -186,7 +186,7 @@ def __call__(cls, *args, **kwargs):
186186
# an external_key to mean generic scope which maps to base ScopeData class.
187187
# The only remaining issue is that internally the namespace key used in policies will be
188188
# The global scope namespace (global^*), so we need to handle that case here.
189-
if kwargs.get("external_key") == GENERIC_SCOPE_WILDCARD:
189+
if kwargs.get("external_key") == GLOBAL_SCOPE_WILDCARD:
190190
return super().__call__(*args, **kwargs)
191191

192192
if "namespaced_key" in kwargs:

openedx_authz/rest_api/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from django.contrib.auth import get_user_model
44
from django.db.models import Q
55

6-
from openedx_authz.api.data import GENERIC_SCOPE_WILDCARD, ScopeData
6+
from openedx_authz.api.data import GLOBAL_SCOPE_WILDCARD, ScopeData
77
from openedx_authz.rest_api.data import SearchField, SortField, SortOrder
88

99
User = get_user_model()
@@ -28,7 +28,7 @@ def get_generic_scope(scope: ScopeData) -> ScopeData:
2828
>>> get_generic_scope(scope)
2929
ScopeData(namespaced_key="lib^*")
3030
"""
31-
return ScopeData(namespaced_key=f"{scope.NAMESPACE}{ScopeData.SEPARATOR}{GENERIC_SCOPE_WILDCARD}")
31+
return ScopeData(namespaced_key=f"{scope.NAMESPACE}{ScopeData.SEPARATOR}{GLOBAL_SCOPE_WILDCARD}")
3232

3333

3434
def get_user_map(usernames: list[str]) -> dict[str, User]:

0 commit comments

Comments
 (0)