refactor(oauth): simplify scopes check with the usage of all()

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2023-11-23 16:04:56 +05:30
parent f8c5a61bbd
commit cc58fd20ca
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -250,10 +250,7 @@ class OAuthWebRequestValidator(RequestValidator):
client_scopes = frappe.db.get_value("OAuth Client", otoken.client, "scopes").split(
get_url_delimiter()
)
are_scopes_valid = True
for scp in scopes:
are_scopes_valid = are_scopes_valid if scp in client_scopes else False
are_scopes_valid = all(scope in client_scopes for scope in scopes)
return is_token_valid and are_scopes_valid
# Token refresh request