Skip to content

Commit

Permalink
[DOCS] [FIX] Small fix in error title
Browse files Browse the repository at this point in the history
  • Loading branch information
s-kostyuk committed Sep 22, 2017
1 parent 84f6f34 commit b58d696
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/source/api/handling_errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ HTTP status code: 400.

.. _error_2001:

Error 2001: Missing username
Error 2001: Missing password
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This error can be thrown on POST requests on ``/auth`` endpoint.
Expand Down Expand Up @@ -277,4 +277,4 @@ FIXME
Placements
----------

FIXME
FIXME
12 changes: 11 additions & 1 deletion dpl/auth/auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ def auth_user(self, username: str, password: str) -> str:

return token

def is_token_valid(self, token: str) -> bool:
"""
Check if the specified token is valid (i.e. is existing, was not
revoked and can still be used for auth)
:param token: an access token to be checked
:return: true if token is valid, force otherwise
"""
return self._token_manager.is_token_present(token)

def is_token_grants(self, token: str, requested_action: object) -> bool:
"""
Check if specified token grants to perform the requested action
Expand All @@ -167,4 +177,4 @@ def is_token_grants(self, token: str, requested_action: object) -> bool:
"""
# TODO: Implement permission checking

return self._token_manager.is_token_present(token)
return self.is_token_valid(token) and True

0 comments on commit b58d696

Please sign in to comment.