Skip to content

Commit

Permalink
chore(api): rename ManageTokensPermission to HasManageTokensPermission
Browse files Browse the repository at this point in the history
  • Loading branch information
peterthomassen committed Jan 6, 2022
1 parent 5233cce commit 66e32ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/desecapi/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def has_permission(self, request, view):
return ip in IPv4Network('10.8.0.0/24')


class ManageTokensPermission(permissions.BasePermission):
class HasManageTokensPermission(permissions.BasePermission):
"""
Permission to check whether a token has "manage tokens" permission.
"""
Expand Down
6 changes: 3 additions & 3 deletions api/desecapi/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def destroy(self, request, *args, **kwargs):

class TokenViewSet(IdempotentDestroyMixin, viewsets.ModelViewSet):
serializer_class = serializers.TokenSerializer
permission_classes = (IsAuthenticated, permissions.ManageTokensPermission,)
permission_classes = (IsAuthenticated, permissions.HasManageTokensPermission,)
throttle_scope = 'account_management_passive'

def get_queryset(self):
Expand Down Expand Up @@ -173,9 +173,9 @@ class TokenDomainPolicyViewSet(IdempotentDestroyMixin, viewsets.ModelViewSet):
def permission_classes(self):
ret = [IsAuthenticated]
if self.request.method in SAFE_METHODS:
ret.append(permissions.ManageTokensPermission | permissions.AuthTokenCorrespondsToViewToken)
ret.append(permissions.HasManageTokensPermission | permissions.AuthTokenCorrespondsToViewToken)
else:
ret.append(permissions.ManageTokensPermission)
ret.append(permissions.HasManageTokensPermission)
return ret

def dispatch(self, request, *args, **kwargs):
Expand Down

0 comments on commit 66e32ab

Please sign in to comment.