Skip to content

Commit

Permalink
Merge pull request #121 from Cadasta/fix/django-tutelary-0.1.10
Browse files Browse the repository at this point in the history
Upgrade to django-tutelary 0.1.10
  • Loading branch information
ian-ross committed Mar 30, 2016
2 parents 23df96a + 11eb2bc commit 0952384
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions cadasta/organization/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from rest_framework import generics
from rest_framework import filters, status

from tutelary.mixins import PermissionRequiredMixin
from tutelary.mixins import APIPermissionRequiredMixin

from accounts.models import User

Expand All @@ -11,7 +11,7 @@
from ..mixins import OrganizationRoles, ProjectRoles


class OrganizationList(PermissionRequiredMixin, generics.ListCreateAPIView):
class OrganizationList(APIPermissionRequiredMixin, generics.ListCreateAPIView):
queryset = Organization.objects.all()
serializer_class = serializers.OrganizationSerializer
filter_backends = (filters.DjangoFilterBackend,
Expand All @@ -27,7 +27,7 @@ class OrganizationList(PermissionRequiredMixin, generics.ListCreateAPIView):
permission_filter_queryset = ('org.view',)


class OrganizationDetail(PermissionRequiredMixin,
class OrganizationDetail(APIPermissionRequiredMixin,
generics.RetrieveUpdateAPIView):
def patch_actions(self, request):
if hasattr(request, 'data'):
Expand All @@ -48,7 +48,7 @@ def patch_actions(self, request):
}


class OrganizationUsers(PermissionRequiredMixin,
class OrganizationUsers(APIPermissionRequiredMixin,
OrganizationRoles,
generics.ListCreateAPIView):
serializer_class = serializers.OrganizationUserSerializer
Expand All @@ -58,7 +58,7 @@ class OrganizationUsers(PermissionRequiredMixin,
}


class OrganizationUsersDetail(PermissionRequiredMixin,
class OrganizationUsersDetail(APIPermissionRequiredMixin,
OrganizationRoles,
generics.RetrieveUpdateDestroyAPIView):
serializer_class = serializers.OrganizationUserSerializer
Expand All @@ -72,7 +72,7 @@ def destroy(self, request, *args, **kwargs):
return Response(status=status.HTTP_204_NO_CONTENT)


class UserAdminList(PermissionRequiredMixin, generics.ListAPIView):
class UserAdminList(APIPermissionRequiredMixin, generics.ListAPIView):
queryset = User.objects.all()
serializer_class = serializers.UserAdminSerializer
filter_backends = (filters.DjangoFilterBackend,
Expand All @@ -84,7 +84,8 @@ class UserAdminList(PermissionRequiredMixin, generics.ListAPIView):
permission_required = 'user.list'


class UserAdminDetail(PermissionRequiredMixin, generics.RetrieveUpdateAPIView):
class UserAdminDetail(APIPermissionRequiredMixin,
generics.RetrieveUpdateAPIView):
serializer_class = serializers.UserAdminSerializer
queryset = User.objects.all()
lookup_field = 'username'
Expand All @@ -94,7 +95,7 @@ class UserAdminDetail(PermissionRequiredMixin, generics.RetrieveUpdateAPIView):
}


class ProjectList(PermissionRequiredMixin, generics.ListCreateAPIView):
class ProjectList(APIPermissionRequiredMixin, generics.ListCreateAPIView):
serializer_class = serializers.ProjectSerializer
filter_backends = (filters.DjangoFilterBackend,
filters.SearchFilter,
Expand Down Expand Up @@ -129,7 +130,7 @@ def get_queryset(self):
return self.get_organization().projects.all()


class ProjectDetail(PermissionRequiredMixin,
class ProjectDetail(APIPermissionRequiredMixin,
generics.RetrieveUpdateDestroyAPIView):
def patch_actions(self, request):
if hasattr(request, 'data'):
Expand Down Expand Up @@ -170,7 +171,7 @@ def get_queryset(self):
return self.get_organization().projects.all()


class ProjectUsers(PermissionRequiredMixin,
class ProjectUsers(APIPermissionRequiredMixin,
ProjectRoles,
generics.ListCreateAPIView):
serializer_class = serializers.ProjectUserSerializer
Expand All @@ -180,7 +181,7 @@ class ProjectUsers(PermissionRequiredMixin,
}


class ProjectUsersDetail(PermissionRequiredMixin,
class ProjectUsersDetail(APIPermissionRequiredMixin,
ProjectRoles,
generics.RetrieveUpdateDestroyAPIView):
serializer_class = serializers.ProjectUserSerializer
Expand Down
2 changes: 1 addition & 1 deletion requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ django-leaflet==0.18.0
jsonschema==2.5.1
rfc3987==1.3.5
drfdocs==0.0.9
django-tutelary==0.1.9
django-tutelary==0.1.10
django-audit-log==0.7.0
simplejson==3.8.1
django-widget-tweaks==1.4.1

0 comments on commit 0952384

Please sign in to comment.