-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add good document streaming endpoint
- Loading branch information
1 parent
a5ce86b
commit 2ebd65a
Showing
4 changed files
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from rest_framework import filters | ||
|
||
|
||
class GoodFilter(filters.BaseFilterBackend): | ||
def filter_queryset(self, request, queryset, view): | ||
return queryset.filter(good_id=view.kwargs["pk"]) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from rest_framework import permissions | ||
|
||
from api.organisations.libraries.get_organisation import get_request_user_organisation_id | ||
|
||
|
||
class IsDocumentInOrganisation(permissions.BasePermission): | ||
def has_object_permission(self, request, view, obj): | ||
return obj.organisation_id == get_request_user_organisation_id(request) |
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