// 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")) {
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!");
}
// 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());
}
}
}
+
void Core::unregisterStorageBackends()
{
foreach(Storage *s, _storageBackends.values()) {
#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());
return true;
}
+
void Core::syncStorage()
{
if (_storage)
return backends;
}
+
QVariantList Core::authenticatorInfo()
{
QVariantList backends;
saveAuthenticatorSettings(backend, settings);
qWarning() << "Switched auth backend to:" << qPrintable(backend);
}
-
+
_authenticator = authenticator;
- return true;
+ return true;
}
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;
}
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)
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);
}
QStringList keys = storage->setupKeys();
QVariantMap defaults = storage->setupDefaults();
return Core::promptForSettings(keys, defaults);
-
}
+
QVariantMap Core::promptForSettings(const Authenticator *authenticator)
{
QStringList keys = authenticator->setupKeys();