Skip to content

Commit

Permalink
Allow multiple roles for Identity.authorize
Browse files Browse the repository at this point in the history
  • Loading branch information
pylover committed Nov 20, 2021
1 parent 907264a commit 16573e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion yhttp/ext/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from .install import install
from .authentication import Authenticator

__version__ = '3.6.0'
__version__ = '3.7.0'
4 changes: 2 additions & 2 deletions yhttp/ext/auth/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __getattr__(self, attr):
except KeyError:
raise AttributeError()

def authorize(self, roles):
def authorize(self, *roles):
if 'roles' not in self.payload:
raise statuses.forbidden()

Expand Down Expand Up @@ -390,7 +390,7 @@ def decorator(handler):
def wrapper(req, *args, **kw):
req.identity = app.auth.verify_token(req)
if roles is not None:
req.identity.authorize(roles)
req.identity.authorize(*roles)

return handler(req, *args, **kw)

Expand Down

0 comments on commit 16573e6

Please sign in to comment.