@requires
need to check all scopes to be required or just one?
#2006
-
I'm thinking about it because we can have any cenarys, example: Supposing we have three roles of user: The current method will check just the first scope in scopes( @requires(['user', 'admin'])
async def foo():
... If the current user is an Thereby, if the idea of the def has_required_scope(conn: HTTPConnection, scopes: typing.Sequence[str]) -> bool:
inside_scopes = [scope in conn.auth.scopes for scope in scopes]
return any(inside_scopes) But, what i suggest is split this validator in two.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's it. 👍 |
Beta Was this translation helpful? Give feedback.
That's it. 👍