Fix AC-263 and AC-264. Update how we check for access to item referenced via foreign key, and determining whether an immutable field has changed.

This commit is contained in:
Chris Church
2013-07-26 15:40:56 -04:00
parent 559b8c96af
commit c3639f96eb
5 changed files with 83 additions and 53 deletions

View File

@@ -285,13 +285,6 @@ class ProjectOrganizationsList(SubListCreateAPIView):
parent_model = Project
relationship = 'organizations'
def get_queryset(self):
# FIXME: Default get_queryset should handle this.
project = Project.objects.get(pk=self.kwargs['pk'])
if not self.request.user.is_superuser:
raise PermissionDenied()
return Organization.objects.filter(projects__in = [ project ])
class ProjectTeamsList(SubListCreateAPIView):
model = Team
@@ -299,12 +292,6 @@ class ProjectTeamsList(SubListCreateAPIView):
parent_model = Project
relationship = 'teams'
def get_queryset(self):
project = Project.objects.get(pk=self.kwargs['pk'])
if not self.request.user.is_superuser:
raise PermissionDenied()
return Team.objects.filter(projects__in = [ project ])
class UserList(ListCreateAPIView):
model = User