11 lines
427 B
Python
11 lines
427 B
Python
from rest_framework.permissions import BasePermission
|
|
|
|
class ClientCredentialPermission(BasePermission):
|
|
def has_permission(self, request, view):
|
|
if request.auth is None:
|
|
return False
|
|
grant_type = request.auth.application.get_authorization_grant_type_display()
|
|
if request.user is None and grant_type == 'Client credentials':
|
|
return True
|
|
else:
|
|
return False |