Skip to content

Commit

Permalink
Raise 404 for any object within disabled project for non-admins
Browse files Browse the repository at this point in the history
Fix #4439
  • Loading branch information
ta2-1 committed Feb 2, 2016
1 parent 3a6eaba commit 9095434
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pootle/apps/pootle_project/views.py
Expand Up @@ -49,9 +49,12 @@ def permission_context(self):

@cached_property
def project(self):
return get_object_or_404(
project = get_object_or_404(
Project.objects.select_related("directory"),
code=self.kwargs["project_code"])
if project.disabled and not self.request.profile.is_superuser:
raise Http404
return project

@property
def url_kwargs(self):
Expand Down
2 changes: 2 additions & 0 deletions pootle/apps/pootle_translationproject/views.py
Expand Up @@ -143,6 +143,8 @@ def tp(self):

@cached_property
def project(self):
if self.tp.project.disabled and not self.request.profile.is_superuser:
raise Http404
return self.tp.project

@cached_property
Expand Down

0 comments on commit 9095434

Please sign in to comment.