This repository has been archived by the owner on Nov 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 797
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(controller): return 403 when a user does not have permission
In our AppViewSet, we set .get_queryset() to give us only the applications that we have either created (i.e. we are the owner) or ones which we were given permission to use (use_app from django-guardian). This is such that when we list apps via /v1/apps, it will only show us that filtered viewset. However, that also limits the scope on what applications we can act upon. Since .get_queryset() returns a queryset of applications that we only know about, it returns a 404 when we try to "ping" an application we were not given access to. To fix this, I have modified `.list()` to display the limited queryset of applications which ther user is the owner or has been given permission to use, and changing the queryset to all applications such that responses from applications which we do not have access to will return a 403 FORBIDDEN.
- Loading branch information
Matthew Fisher
committed
Jan 21, 2015
1 parent
2359596
commit 861108a
Showing
3 changed files
with
17 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters