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

@@ -10,7 +10,6 @@ from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthenticat
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from rest_condition import C
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -156,16 +155,17 @@ class CertificatesListView(APIView):
BearerAuthenticationAllowInactiveUser,
SessionAuthenticationAllowInactiveUser,
)
# pylint: disable=unsupported-binary-operation
permission_classes = (
C(IsAuthenticated) & (
C(permissions.NotJwtRestrictedApplication) |
IsAuthenticated & (
permissions.NotJwtRestrictedApplication |
(
C(permissions.JwtRestrictedApplication) &
permissions.JwtRestrictedApplication &
permissions.JwtHasScope &
permissions.JwtHasUserFilterForRequestedUser
)
),
(C(permissions.IsStaff) | IsOwnerOrPublicCertificates), # pylint: disable=unsupported-binary-operation
permissions.IsStaff | IsOwnerOrPublicCertificates,
)
required_scopes = ['certificates:read']