Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chores] Centralized ProtectedApiMixin logic #280
Closes #280
- Loading branch information
1 parent
bf1d7d7
commit 38628f6
Showing
2 changed files
with
13 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 |
---|---|---|
|
@@ -5,3 +5,4 @@ omit = | |
/*/__init__.py | ||
/setup.py | ||
/*/migrations/* | ||
openwisp_utils/api/mixins.py |
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,12 @@ | ||
from openwisp_users.api.authentication import BearerAuthentication | ||
from openwisp_users.api.permissions import DjangoModelPermissions | ||
from rest_framework.authentication import SessionAuthentication | ||
from rest_framework.permissions import IsAuthenticated | ||
|
||
|
||
class ProtectedAPIMixin(object): | ||
authentication_classes = [BearerAuthentication, SessionAuthentication] | ||
permission_classes = [ | ||
IsAuthenticated, | ||
DjangoModelPermissions, | ||
] |