Skip to content

Commit 9d06ab0

Browse files
committed
refactor: validate IsAuthenticated permission first
1 parent 7565947 commit 9d06ab0

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

openedx_authz/rest_api/utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ def _decorator(func_or_class):
2020
"""
2121
Requires either OAuth2 or Session-based authentication.
2222
"""
23-
func_or_class.authentication_classes = (
23+
func_or_class.authentication_classes = [
2424
JwtAuthentication,
2525
SessionAuthenticationAllowInactiveUser,
26-
)
27-
func_or_class.permission_classes = ()
26+
]
2827
if is_authenticated:
29-
func_or_class.permission_classes += (IsAuthenticated,)
28+
func_or_class.permission_classes.insert(0, IsAuthenticated)
3029
return func_or_class
3130

3231
return _decorator

0 commit comments

Comments
 (0)