Skip to content

Commit

Permalink
Enforce authentication for all secrets API views
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Jul 18, 2016
1 parent c4c54b2 commit 22dbc10
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions netbox/secrets/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class SecretRoleListView(generics.ListAPIView):
"""
queryset = SecretRole.objects.all()
serializer_class = serializers.SecretRoleSerializer
permission_classes = [IsAuthenticated]


class SecretRoleDetailView(generics.RetrieveAPIView):
Expand All @@ -36,6 +37,7 @@ class SecretRoleDetailView(generics.RetrieveAPIView):
"""
queryset = SecretRole.objects.all()
serializer_class = serializers.SecretRoleSerializer
permission_classes = [IsAuthenticated]


class SecretListView(generics.GenericAPIView):
Expand All @@ -47,6 +49,7 @@ class SecretListView(generics.GenericAPIView):
serializer_class = serializers.SecretSerializer
filter_class = SecretFilter
renderer_classes = [FormlessBrowsableAPIRenderer, JSONRenderer, FreeRADIUSClientsRenderer]
permission_classes = [IsAuthenticated]

def get(self, request, private_key=None):
queryset = self.filter_queryset(self.get_queryset())
Expand Down Expand Up @@ -91,6 +94,7 @@ class SecretDetailView(generics.GenericAPIView):
.prefetch_related('role__users', 'role__groups')
serializer_class = serializers.SecretSerializer
renderer_classes = [FormlessBrowsableAPIRenderer, JSONRenderer, FreeRADIUSClientsRenderer]
permission_classes = [IsAuthenticated]

def get(self, request, pk, private_key=None):
secret = get_object_or_404(Secret, pk=pk)
Expand Down

0 comments on commit 22dbc10

Please sign in to comment.