use ParentMixin machinery to check access_list parent obj permissions

This commit is contained in:
AlanCoding
2017-01-04 13:39:14 -05:00
parent 448b066cfc
commit bd82ab9fb0
3 changed files with 11 additions and 14 deletions

View File

@@ -558,14 +558,12 @@ class DestroyAPIView(GenericAPIView, generics.DestroyAPIView):
pass
class ResourceAccessList(ListAPIView):
class ResourceAccessList(ParentMixin, ListAPIView):
serializer_class = ResourceAccessListElementSerializer
def get_queryset(self):
self.object_id = self.kwargs['pk']
resource_model = getattr(self, 'resource_model')
obj = get_object_or_404(resource_model, pk=self.object_id)
obj = self.get_parent_object()
content_type = ContentType.objects.get_for_model(obj)
roles = set(Role.objects.filter(content_type=content_type, object_id=obj.id))