Skip to content

Commit

Permalink
[chores] Used openwisp-users ProtectedAPIMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryamanz29 committed Dec 13, 2022
1 parent 956d9d2 commit 3bc76c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions openwisp_ipam/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import swapper
from django.http import HttpResponse
from django.utils.translation import gettext_lazy as _
from openwisp_users.api.authentication import BearerAuthentication
from openwisp_users.api.mixins import FilterByOrganizationManaged, FilterByParentManaged
from openwisp_users.api.mixins import (
FilterByOrganizationManaged,
FilterByParentManaged,
ProtectedAPIMixin as BaseProtectedAPIMixin,
)
from openwisp_users.api.permissions import IsOrganizationManager
from rest_framework import pagination, serializers, status
from rest_framework.authentication import SessionAuthentication
from rest_framework.generics import (
CreateAPIView,
ListAPIView,
Expand Down Expand Up @@ -44,8 +46,7 @@ def get_parent_queryset(self):
return qs


class ProtectedAPIMixin(object):
authentication_classes = [BearerAuthentication, SessionAuthentication]
class ProtectedAPIMixin(BaseProtectedAPIMixin):
permission_classes = [IsOrganizationManager, DjangoModelPermissions]
throttle_scope = 'ipam'

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openwisp-users @ https://github.com/openwisp/openwisp-users/tarball/master
openwisp-users @ https://github.com/openwisp/openwisp-users/tarball/issue-337/centralize-protected-api-mixin
openwisp-utils[rest] @ https://github.com/openwisp/openwisp-utils/tarball/master
django>=3.0.0,<4.1.0
openpyxl~=3.0.9
Expand Down

0 comments on commit 3bc76c8

Please sign in to comment.