From: Afreen Misbah Date: Fri, 14 Mar 2025 05:50:30 +0000 (+0530) Subject: mgr/dashboard: fix OAuth2 SSO when roles_path is empty X-Git-Tag: v20.3.0~364^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=737ae7f73a8d7d5c705720ff3281c1783ec4d2ac;p=ceph.git mgr/dashboard: fix OAuth2 SSO when roles_path is empty Fixes https://tracker.ceph.com/issues/70454 Due to PR linter updates, this place remained not updated hence failing Signed-off-by: Afreen Misbah --- diff --git a/src/pybind/mgr/dashboard/services/auth/oauth2.py b/src/pybind/mgr/dashboard/services/auth/oauth2.py index 26027adf603d9..5087885289790 100644 --- a/src/pybind/mgr/dashboard/services/auth/oauth2.py +++ b/src/pybind/mgr/dashboard/services/auth/oauth2.py @@ -93,7 +93,7 @@ class OAuth2(SSOAuth): except AttributeError: raise cherrypy.HTTPError(401) - if jmespath and hasattr(mgr.SSO_DB.config, 'roles_path'): + if jmespath and getattr(mgr.SSO_DB.config, 'roles_path', None): logger.debug("Using 'roles_path' to fetch roles") roles = jmespath.search(mgr.SSO_DB.config.roles_path, jwt_payload) # e.g Keycloak