diff --git a/jobposting/views.py b/jobposting/views.py index 7c16a18..3555778 100644 --- a/jobposting/views.py +++ b/jobposting/views.py @@ -5,7 +5,7 @@ from core.models import MyUser, AnonymousUserData from rest_framework import status from jobposting.permissions import ClientCredentialPermission from oauth2_provider.contrib.rest_framework import TokenHasReadWriteScope, OAuth2Authentication - +from auth import OAuth2ClientCredentialAuthentication from jobposting.serializers import ( @@ -17,16 +17,16 @@ from jobposting.serializers import ( ) class MyUserViewSet(viewsets.ModelViewSet): - authentication_classes = [OAuth2Authentication] - permission_classes = [TokenHasReadWriteScope] # test only + authentication_classes = [OAuth2ClientCredentialAuthentication] + # permission_classes = [TokenHasReadWriteScope] # test only queryset = MyUser.objects.all() serializer_class = MyUserSerializer - required_scope = ['main'] + # required_scope = ['main'] # permission_classes = [permissions.IsAuthenticated] class JobListingViewSet(viewsets.ModelViewSet): - authentication_classes = [OAuth2Authentication] - permission_classes = [TokenHasReadWriteScope] # test only + authentication_classes = [OAuth2ClientCredentialAuthentication] + # permission_classes = [TokenHasReadWriteScope] # test only queryset = JobListing.objects.all() serializer_class = JobListingSerializer required_scope = ['main'] @@ -52,11 +52,11 @@ class JobListingViewSet(viewsets.ModelViewSet): serializer.save(anonymous_user_data=anonymous_user_data) class SkillLevelsViewSet(viewsets.ModelViewSet): - authentication_classes = [OAuth2Authentication] - permission_classes = [TokenHasReadWriteScope] # test only + authentication_classes = [OAuth2ClientCredentialAuthentication] + # permission_classes = [TokenHasReadWriteScope] # test only queryset = SkillLevels.objects.all() serializer_class = SkillLevelsSerializer - required_scope = ['main'] + # required_scope = ['main'] # permission_classes = [permissions.IsAuthenticatedOrReadOnly] @@ -73,16 +73,16 @@ class SkillLevelsViewSet(viewsets.ModelViewSet): return super().create(request, *args, **kwargs) class CompanyLogoViewSet(viewsets.ModelViewSet): - authentication_classes = [OAuth2Authentication] - permission_classes = [TokenHasReadWriteScope] + authentication_classes = [OAuth2ClientCredentialAuthentication] + # permission_classes = [TokenHasReadWriteScope] queryset = CompanyLogo.objects.all() serializer_class = CompanyLogoSerializer - required_scope = ['main'] + # required_scope = ['main'] class SkillViewset(viewsets.ModelViewSet): - authentication_classes = [OAuth2Authentication] - permission_classes = [TokenHasReadWriteScope] + authentication_classes = [OAuth2ClientCredentialAuthentication] + # permission_classes = [TokenHasReadWriteScope] queryset = Skill.objects.all() serializer_class = SkillSerializer - required_scope = ['main'] + # required_scope = ['main']