Skip to content

Commit

Permalink
fix permissions on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Glatthard committed Aug 7, 2015
1 parent 4ab79e9 commit 0325710
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 4 additions & 5 deletions ipynbsrv/api/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,23 @@ class FlatBackendUserSerializer(serializers.ModelSerializer):
"""
Todo: write doc.
"""
username = serializers.CharField(source='get_username')
collab_group = FlatCollaborationGroupSerializer(source='get_collaboration_group')

class Meta:
model = BackendUser
fields = ('id', 'username', 'collab_group')
fields = ('id', 'collab_group',)


class UserSerializer(serializers.ModelSerializer):
"""
Todo: write doc.
"""
backend_user = FlatBackendUserSerializer()
backend_user = FlatBackendUserSerializer(read_only=True, many=False)

class Meta:
model = User
fields = ('id', 'username', 'backend_user')
read_only_fields = ('id', 'username', )
fields = ('id', 'username', 'backend_user', 'is_active', 'is_staff')
read_only_fields = ('id', 'username', 'backend_user', 'is_staff')


class NestedBackendUserSerializer(serializers.ModelSerializer):
Expand Down
7 changes: 5 additions & 2 deletions ipynbsrv/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class UserList(generics.ListAPIView):
permission_classes = [IsSuperUserOrReadOnly]


class UserDetails(generics.RetrieveAPIView):
class UserDetails(generics.RetrieveUpdateDestroyAPIView):
"""
Get a list of all users (`django.contrib.auth.models.User`).
Only visible to authenticated users.
Expand Down Expand Up @@ -802,10 +802,13 @@ def get_queryset(self):
return queryset


class TagDetail(generics.RetrieveUpdateDestroyAPIView):
class TagDetail(generics.RetrieveDestroyAPIView):
"""
Get details of a tag.
"""

permission_classes = [IsSuperUserOrReadOnly]

queryset = Tag.objects.all()
serializer_class = TagSerializer

Expand Down

0 comments on commit 0325710

Please sign in to comment.