chore: remove dependency on rest_condition (#28663)

rest-condition has not been updated for a while, and with DRF 3.9 it is no longer needed since the ability to combine Permission classes using boolean operators is now provided by DRF directly.
This commit is contained in:
Kshitij Sobti
2021-10-04 19:38:17 +00:00
committed by GitHub
parent a916123b04
commit 9e787a09bc
14 changed files with 68 additions and 142 deletions

View File

@@ -12,7 +12,6 @@ from edx_rest_framework_extensions.permissions import (
JwtRestrictedApplication,
NotJwtRestrictedApplication
)
from rest_condition import C
from rest_framework.permissions import BasePermission
from openedx.core.lib.api.permissions import ApiKeyHeaderPermission
@@ -51,11 +50,11 @@ class JwtHasTpaProviderFilterForRequestedProvider(BasePermission):
# TODO: Remove ApiKeyHeaderPermission. Check deprecated_api_key_header custom attribute for active usage.
_NOT_JWT_RESTRICTED_TPA_PERMISSIONS = (
C(NotJwtRestrictedApplication) &
(C(IsSuperuser) | ApiKeyHeaderPermission | C(IsStaff)) # pylint: disable=unsupported-binary-operation
NotJwtRestrictedApplication &
(IsSuperuser | ApiKeyHeaderPermission | IsStaff) # pylint: disable=unsupported-binary-operation
)
_JWT_RESTRICTED_TPA_PERMISSIONS = (
C(JwtRestrictedApplication) &
JwtRestrictedApplication &
JwtHasScope &
JwtHasTpaProviderFilterForRequestedProvider
)