Skip to content

Commit

Permalink
[chores] Centralized ProtectedApiMixin logic #280
Browse files Browse the repository at this point in the history
Closes #280
  • Loading branch information
Aryamanz29 committed Dec 12, 2022
1 parent bf1d7d7 commit 38628f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Expand Up @@ -5,3 +5,4 @@ omit =
/*/__init__.py
/setup.py
/*/migrations/*
openwisp_utils/api/mixins.py
12 changes: 12 additions & 0 deletions openwisp_utils/api/mixins.py
@@ -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,
]

0 comments on commit 38628f6

Please sign in to comment.