diff --git a/confluent_server/confluent/auth.py b/confluent_server/confluent/auth.py index 9c1c7a3d..4c535f78 100644 --- a/confluent_server/confluent/auth.py +++ b/confluent_server/confluent/auth.py @@ -108,6 +108,8 @@ def authorize(name, element, tenant=False, operation='create', and the relevant ConfigManager object for the context of the request. """ + if operation not in ('create', 'start', 'update', 'retrieve', 'delete'): + return None user, tenant = _get_usertenant(name, tenant) if tenant is not None and not configmanager.is_tenant(tenant): return None diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index 55455735..7594794f 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -1123,6 +1123,13 @@ class ConfigManager(object): except OSError: pass + @classmethod + def shutdown(cls): + cls._bg_sync_to_file() + if cls._cfgwriter is not None: + cls._cfgwriter.join() + sys.exit(0) + @classmethod def _bg_sync_to_file(cls): with cls._syncstate: diff --git a/confluent_server/confluent/sockapi.py b/confluent_server/confluent/sockapi.py index 9a291dd7..f8b31cc4 100644 --- a/confluent_server/confluent/sockapi.py +++ b/confluent_server/confluent/sockapi.py @@ -184,6 +184,8 @@ def process_request(connection, request, cfm, authdata, authname, skipauth): consession.destroy() return consession.write(data) + elif operation == 'shutdown': + configmanager.ConfigManager.shutdown() else: hdlr = pluginapi.handle_path(path, operation, cfm, params) except exc.NotFoundException: