|
1 | 1 | """Permissions for the Open edX AuthZ REST API.""" |
2 | 2 |
|
| 3 | +from typing import ClassVar |
| 4 | + |
3 | 5 | from rest_framework.permissions import BasePermission |
4 | 6 |
|
5 | 7 | from openedx_authz import api |
@@ -51,8 +53,8 @@ class BaseScopePermission(BasePermission, metaclass=PermissionMeta): |
51 | 53 | specific authorization logic for their scope types. |
52 | 54 | """ |
53 | 55 |
|
54 | | - NAMESPACE = "sc" |
55 | | - """The namespace identifier for this permission class (default: ``sc`` for generic scopes).""" |
| 56 | + NAMESPACE: ClassVar[str] = "sc" |
| 57 | + """The namespace identifier for this permission class. Default ``sc`` for generic scopes.""" |
56 | 58 |
|
57 | 59 | def get_scope_value(self, request) -> str | None: |
58 | 60 | """Extract the scope value from the request. |
@@ -127,7 +129,7 @@ class ContentLibraryPermission(BaseScopePermission): |
127 | 129 | - GET requests require ``view_library_team`` permission. |
128 | 130 | """ |
129 | 131 |
|
130 | | - NAMESPACE = "lib" |
| 132 | + NAMESPACE: ClassVar[str] = "lib" |
131 | 133 | """``lib`` for content library scopes.""" |
132 | 134 |
|
133 | 135 | def has_permission(self, request, view) -> bool: |
@@ -177,8 +179,8 @@ class DynamicScopePermission(BaseScopePermission): |
177 | 179 | Superusers and staff members always have permission regardless of scope. |
178 | 180 | """ |
179 | 181 |
|
180 | | - NAMESPACE = None |
181 | | - """``None`` (this is a dispatcher, not tied to a specific namespace).""" |
| 182 | + NAMESPACE: ClassVar[None] = None |
| 183 | + """This is a dispatcher, not tied to a specific namespace.""" |
182 | 184 |
|
183 | 185 | def _get_permission_instance(self, request) -> BaseScopePermission: |
184 | 186 | """Instantiate the permission class for the request scope. |
|
0 commit comments