From: Ricardo Dias Date: Fri, 20 Apr 2018 15:37:11 +0000 (+0100) Subject: mgr/dashboard: load and cofigure authorization system X-Git-Tag: v14.0.1~1019^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2823013b45dfa25d0c98ee238add8f5808db3c93;p=ceph.git mgr/dashboard: load and cofigure authorization system Signed-off-by: Ricardo Dias --- diff --git a/src/pybind/mgr/dashboard/module.py b/src/pybind/mgr/dashboard/module.py index cd91d2a1a2ef3..cb2baa3a7eb5c 100644 --- a/src/pybind/mgr/dashboard/module.py +++ b/src/pybind/mgr/dashboard/module.py @@ -61,6 +61,9 @@ from .controllers import generate_routes, json_error_page from .controllers.auth import Auth from .tools import SessionExpireAtBrowserCloseTool, NotificationQueue, \ RequestLoggingTool, TaskManager +from .services.auth import AuthManager +from .services.access_control import ACCESS_CONTROL_COMMANDS, \ + handle_access_control_command from .services.exception import dashboard_exception_handler from .settings import options_command_list, options_schema_list, \ handle_option_command @@ -227,6 +230,7 @@ class Module(MgrModule, SSLCherryPyConfig): }, ] COMMANDS.extend(options_command_list()) + COMMANDS.extend(ACCESS_CONTROL_COMMANDS) OPTIONS = [ {'name': 'server_addr'}, @@ -268,6 +272,8 @@ class Module(MgrModule, SSLCherryPyConfig): if 'COVERAGE_ENABLED' in os.environ: _cov.start() + AuthManager.initialize() + uri = self.await_configuration() if uri is None: # We were shut down while waiting @@ -314,6 +320,9 @@ class Module(MgrModule, SSLCherryPyConfig): def handle_command(self, inbuf, cmd): res = handle_option_command(cmd) + if res[0] != -errno.ENOSYS: + return res + res = handle_access_control_command(cmd) if res[0] != -errno.ENOSYS: return res if cmd['prefix'] == 'dashboard set-login-credentials': diff --git a/src/pybind/mgr/dashboard/tests/helper.py b/src/pybind/mgr/dashboard/tests/helper.py index e98a770c62163..6b578a08713ed 100644 --- a/src/pybind/mgr/dashboard/tests/helper.py +++ b/src/pybind/mgr/dashboard/tests/helper.py @@ -11,8 +11,8 @@ from cherrypy._cptools import HandlerWrapperTool from cherrypy.test import helper from .. import logger -from ..controllers.auth import Auth from ..controllers import json_error_page, generate_controller_routes +from ..controllers.auth import Auth from ..services.exception import dashboard_exception_handler from ..tools import SessionExpireAtBrowserCloseTool