X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=bb1df473173a3042e7516e38ab1ba8f41c78108f;hp=6ad670268cd452a983247d202a9f929cfda53410;hb=39c33d8cbaecdd1e5c756a715bef87844149ae5b;hpb=258d157a228d2b2b46b01d3b33ab932b9979436a diff --git a/src/core/core.cpp b/src/core/core.cpp index 6ad67026..bb1df473 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -191,7 +191,7 @@ void Core::init() // Not entirely sure what is 'legacy' about the above, but it seems to be the way things work! QVariantMap authSettings = cs.authSettings().toMap(); - initAuthenticator(authSettings.value("Authenticator").toString(), authSettings.value("ConnectionProperties").toMap()); + initAuthenticator(authSettings.value("Authenticator").toString(), authSettings.value("AuthProperties").toMap()); if (Quassel::isOptionSet("select-backend") || Quassel::isOptionSet("select-authenticator")) { if (Quassel::isOptionSet("select-backend")) { @@ -317,7 +317,7 @@ QString Core::setupCore(const QString &adminUser, const QString &adminPassword, return tr("Could not setup storage!"); } - quInfo() << "Selected authenticator: " << authenticator; + quInfo() << "Selected authenticator:" << authenticator; if (!(_configured = initAuthenticator(authenticator, authSetupData, true))) { return tr("Could not setup authenticator!"); @@ -347,7 +347,7 @@ QString Core::setupCoreForInternalUsage() } // mono client currently needs sqlite - return setupCore("AdminUser", QString::number(pass), "SQLite", QVariantMap(), "StorageAuth", QVariantMap()); + return setupCore("AdminUser", QString::number(pass), "SQLite", QVariantMap(), "Database", QVariantMap()); } @@ -372,6 +372,7 @@ bool Core::registerStorageBackend(Storage *backend) } } + void Core::unregisterStorageBackends() { foreach(Storage *s, _storageBackends.values()) { @@ -397,30 +398,31 @@ void Core::registerAuthenticators() #ifdef HAVE_LDAP registerAuthenticator(new LdapAuthenticator(this)); #endif - } + bool Core::registerAuthenticator(Authenticator *authenticator) { - if (authenticator->isAvailable()) - { + if (authenticator->isAvailable()) { _authenticators[authenticator->backendId()] = authenticator; return true; - } else { + } + else { authenticator->deleteLater(); return false; } } + void Core::unregisterAuthenticators() { - foreach(Authenticator* a, _authenticators.values()) - { + foreach(Authenticator* a, _authenticators.values()) { a->deleteLater(); } _authenticators.clear(); } + void Core::unregisterAuthenticator(Authenticator *backend) { _authenticators.remove(backend->backendId()); @@ -506,6 +508,7 @@ bool Core::initAuthenticator(const QString &backend, const QVariantMap &settings return true; } + void Core::syncStorage() { if (_storage) @@ -790,6 +793,7 @@ QVariantList Core::backendInfo() return backends; } + QVariantList Core::authenticatorInfo() { QVariantList backends; @@ -925,9 +929,9 @@ bool Core::selectAuthenticator(const QString &backend) saveAuthenticatorSettings(backend, settings); qWarning() << "Switched auth backend to:" << qPrintable(backend); } - + _authenticator = authenticator; - return true; + return true; } @@ -981,8 +985,7 @@ bool Core::changeUserPass(const QString &username) return false; } - if (!canChangeUserPassword(userId)) - { + if (!canChangeUserPassword(userId)) { out << "User " << username << " is configured through an auth provider that has forbidden manual password changing." << endl; return false; } @@ -1038,17 +1041,18 @@ bool Core::changeUserPassword(UserId userId, const QString &password) bool Core::canChangeUserPassword(UserId userId) { QString authProvider = instance()->_storage->getUserAuthenticator(userId); - if (authProvider != "Database") - { + if (authProvider != "Database") { if (authProvider != instance()->_authenticator->backendId()) { return false; - } else if (instance()->_authenticator->canChangePassword()) { + } + else if (instance()->_authenticator->canChangePassword()) { return false; } } return true; } + AbstractSqlMigrationReader *Core::getMigrationReader(Storage *storage) { if (!storage) @@ -1089,11 +1093,12 @@ bool Core::saveBackendSettings(const QString &backend, const QVariantMap &settin return s.sync(); } + void Core::saveAuthenticatorSettings(const QString &backend, const QVariantMap &settings) { QVariantMap dbsettings; dbsettings["Authenticator"] = backend; - dbsettings["ConnectionProperties"] = settings; + dbsettings["AuthProperties"] = settings; CoreSettings().setAuthSettings(dbsettings); } @@ -1154,9 +1159,9 @@ QVariantMap Core::promptForSettings(const Storage *storage) QStringList keys = storage->setupKeys(); QVariantMap defaults = storage->setupDefaults(); return Core::promptForSettings(keys, defaults); - } + QVariantMap Core::promptForSettings(const Authenticator *authenticator) { QStringList keys = authenticator->setupKeys();