File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed
services/web/server/src/simcore_service_webserver/security Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change 55 https://b_logger.nodeswat.com/implement-access-control-in-node-js-8567e7b484d1
66"""
77
8- import inspect
98import logging
109from collections .abc import Awaitable , Callable
1110from dataclasses import dataclass , field
1211from typing import TypeAlias , TypedDict
1312
13+ from common_library .async_tools import maybe_await
1414from models_library .products import ProductName
1515from models_library .users import UserID
1616
@@ -114,13 +114,7 @@ async def can(
114114 if operation in role_access .check :
115115 check = role_access .check [operation ]
116116 try :
117- ok : bool
118- coro_or_result = check (context )
119- if inspect .isawaitable (coro_or_result ):
120- ok = await coro_or_result
121- else :
122- ok = coro_or_result
123- return ok
117+ return await maybe_await (check (context ))
124118
125119 except Exception : # pylint: disable=broad-except
126120 _logger .debug (
You can’t perform that action at this time.
0 commit comments