Source code for intranet.apps.auth.rest_permissions
from rest_framework import permissions
[docs]class DenyRestrictedPermission(permissions.BasePermission):
[docs] def has_permission(self, request, view) -> bool:
return request.user and request.user.is_authenticated and not request.user.is_restricted
[docs]class ApiAndOauthPermission(permissions.BasePermission):
[docs] def has_permission(self, request, view) -> bool:
return request.user and request.user.is_authenticated and not request.user.is_restricted and request.user.oauth_and_api_access