Skip to content

Commit

Permalink
concept locales permissions to authenticated or ready only
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Nov 13, 2020
1 parent e72abad commit 162caec
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions core/concepts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from rest_framework.generics import RetrieveAPIView, DestroyAPIView, ListCreateAPIView, RetrieveUpdateDestroyAPIView, \
ListAPIView, UpdateAPIView
from rest_framework.mixins import CreateModelMixin
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework.response import Response

from core.common.constants import (
Expand Down Expand Up @@ -281,15 +282,9 @@ def create(self, request, **_):
class ConceptLabelRetrieveUpdateDestroyView(ConceptBaseView, RetrieveUpdateDestroyAPIView):
model = LocalizedText
parent_list_attribute = None
permission_classes = (CanEditParentDictionary,)
permission_classes = (IsAuthenticatedOrReadOnly,)
default_qs_sort_attr = '-created_at'

def get_permissions(self):
if self.request.method in ['GET', 'HEAD']:
return [CanViewParentDictionary()]

return [CanEditParentDictionary()]

def get_queryset(self):
if not self.parent_list_attribute:
return None
Expand Down

0 comments on commit 162caec

Please sign in to comment.