oauth2 ustawienia + uprawnienia
All checks were successful
continuous-integration/drone Build is passing
All checks were successful
continuous-integration/drone Build is passing
This commit is contained in:
11
jobposting/permissions.py
Normal file
11
jobposting/permissions.py
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
@@ -3,7 +3,7 @@ from rest_framework.response import Response
|
||||
from jobposting.models import JobListing, SkillLevels, CompanyLogo, Skill
|
||||
from core.models import MyUser, AnonymousUserData
|
||||
from rest_framework import status
|
||||
from izaac.permissions import ClientCredentialPermission
|
||||
from jobposting.permissions import ClientCredentialPermission
|
||||
from oauth2_provider.contrib.rest_framework import TokenHasReadWriteScope
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user