Skip to content

Saleor Core: the high performance, composable, headless commerce API.

add function return type and utilised list comprehension (#13108)

AjmalPonneth7457541b3ca6
diff --git a/saleor/permission/utils.py b/saleor/permission/utils.py
index 91633fe776..3432b5c44b 100644
--- a/saleor/permission/utils.py
+++ b/saleor/permission/utils.py
@@ -10,7 +10,7 @@ if TYPE_CHECKING:
def one_of_permissions_or_auth_filter_required(
context, permissions: Iterable[BasePermissionEnum]
-):
+) -> bool:
"""Determine whether user or app has rights to perform an action.
The `context` parameter is the Context instance associated with the request.
@@ -32,9 +32,7 @@ def one_of_permissions_or_auth_filter_required(
requestor = get_user_or_app_from_context(context)
if requestor and permissions:
- perm_checks_results = []
- for permission in permissions:
- perm_checks_results.append(requestor.has_perm(permission))
+ perm_checks_results = [requestor.has_perm(perm) for perm in permissions]
granted_by_permissions = any(perm_checks_results)
if authorization_filters: