diff options
Diffstat (limited to 'src/mongo/db/auth/authorization_manager_global.cpp')
-rw-r--r-- | src/mongo/db/auth/authorization_manager_global.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/mongo/db/auth/authorization_manager_global.cpp b/src/mongo/db/auth/authorization_manager_global.cpp index 3f8a8808d04..0088ac451d5 100644 --- a/src/mongo/db/auth/authorization_manager_global.cpp +++ b/src/mongo/db/auth/authorization_manager_global.cpp @@ -91,23 +91,16 @@ AuthorizationManager* getGlobalAuthorizationManager() { MONGO_EXPORT_STARTUP_SERVER_PARAMETER(startupAuthSchemaValidation, bool, true); -GlobalInitializerRegisterer authorizationManagerInitializer( +ServiceContext::ConstructorActionRegisterer createAuthorizationManager( "CreateAuthorizationManager", - {MONGO_SHIM_DEPENDENCY(AuthorizationManager::create), - "OIDGeneration", + {"OIDGeneration", "EndStartupOptionStorage", - "ServiceContext"}, - [](InitializerContext* context) { + MONGO_SHIM_DEPENDENCY(AuthorizationManager::create)}, + [](ServiceContext* service) { auto authzManager = AuthorizationManager::create(); authzManager->setAuthEnabled(serverGlobalParams.authState == ServerGlobalParams::AuthState::kEnabled); authzManager->setShouldValidateAuthSchemaOnStartup(startupAuthSchemaValidation); - AuthorizationManager::set(getGlobalServiceContext(), std::move(authzManager)); - return Status::OK(); - }, - [](DeinitializerContext* context) { - AuthorizationManager::set(getGlobalServiceContext(), nullptr); - return Status::OK(); + AuthorizationManager::set(service, std::move(authzManager)); }); - } // namespace mongo |