ldap: Don't use the backend's display name as identifier
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 23 Oct 2016 23:03:16 +0000 (01:03 +0200)
committerBen Rosser <rosser.bjr@gmail.com>
Sat, 27 May 2017 18:01:06 +0000 (14:01 -0400)
We'd like to have the display name translatable, so it should not
be used as an identifer. Instead, introduce a backendId property
for this purpose.

src/core/authenticator.h
src/core/core.cpp
src/core/ldapauthenticator.cpp
src/core/ldapauthenticator.h
src/core/sqlauthenticator.cpp
src/core/sqlauthenticator.h
src/qtui/coreconfigwizard.cpp

index 97091ef..3bec6f6 100644 (file)
@@ -52,9 +52,13 @@ public slots:
      */
     virtual bool isAvailable() const = 0;
 
+    //! Returns the identifier of the authenticator backend
+    /** \return A string that can be used by the client to identify the authenticator backend */
+    virtual QString backendId() const = 0;
+
     //! Returns the display name of the authenticator backend
     /** \return A string that can be used by the client to name the authenticator backend */
-    virtual QString backendId() const = 0;
+    virtual QString displayName() const = 0;
 
     //! Returns a description of this authenticator backend
     /** \return A string that can be displayed by the client to describe the authenticator */
index bb1df47..4aab673 100644 (file)
@@ -799,7 +799,8 @@ QVariantList Core::authenticatorInfo()
     QVariantList backends;
     foreach(const Authenticator *backend, instance()->_authenticators.values()) {
         QVariantMap v;
-        v["DisplayName"] = backend->backendId();
+        v["BackendId"] = backend->backendId();
+        v["DisplayName"] = backend->displayName();
         v["Description"] = backend->description();
         v["SetupKeys"] = backend->setupKeys();
         v["SetupDefaults"] = backend->setupDefaults();
index b9f9922..227df19 100644 (file)
@@ -65,13 +65,19 @@ bool LdapAuthenticator::isAvailable() const
 
 QString LdapAuthenticator::backendId() const
 {
-    // We identify the backend to use for the monolithic core by its displayname.
+    // We identify the backend to use for the monolithic core by this identifier.
     // so only change this string if you _really_ have to and make sure the core
     // setup for the mono client still works ;)
     return QString("LDAP");
 }
 
 
+QString LdapAuthenticator::displayName() const
+{
+    return tr("LDAP");
+}
+
+
 QString LdapAuthenticator::description() const
 {
     return tr("Authenticate users using an LDAP server.");
index 59a35b6..8415496 100644 (file)
@@ -57,6 +57,7 @@ public slots:
     /* General */
     bool isAvailable() const;
     QString backendId() const;
+    QString displayName() const;
     QString description() const;
     virtual QStringList setupKeys() const;
     virtual QVariantMap setupDefaults() const;
index 4977218..3be817b 100644 (file)
@@ -46,13 +46,19 @@ bool SqlAuthenticator::isAvailable() const
 
 QString SqlAuthenticator::backendId() const
 {
-    // We identify the backend to use for the monolithic core by its displayname.
+    // We identify the backend to use for the monolithic core by this identifier.
     // so only change this string if you _really_ have to and make sure the core
     // setup for the mono client still works ;)
     return QString("Database");
 }
 
 
+QString SqlAuthenticator::displayName() const
+{
+    return tr("Database");
+}
+
+
 QString SqlAuthenticator::description() const
 {
     return tr("Do not auth against any remote authentication service, but instead save a hashed and salted password "
index c392045..b5a010a 100644 (file)
@@ -34,6 +34,7 @@ public slots:
     /* General */
     bool isAvailable() const;
     QString backendId() const;
+    QString displayName() const;
     QString description() const;
     virtual inline QStringList setupKeys() const { return QStringList(); }
     virtual inline QVariantMap setupDefaults() const { return QVariantMap(); }
index 99fc354..401fd61 100644 (file)
@@ -40,7 +40,7 @@ CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QList<QVari
         _backends[v.toMap()["DisplayName"].toString()] = v;
 
     foreach(const QVariant &v, authenticators)
-        _authenticators[v.toMap()["DisplayName"].toString()] = v;
+        _authenticators[v.toMap()["BackendId"].toString()] = v;
 
     setPage(IntroPage, new CoreConfigWizardPages::IntroPage(this));
     setPage(AdminUserPage, new CoreConfigWizardPages::AdminUserPage(this));
@@ -222,7 +222,6 @@ AuthenticationSelectionPage::AuthenticationSelectionPage(const QHash<QString, QV
 
     setTitle(tr("Select Authentication Backend"));
     setSubTitle(tr("Please select a backend for Quassel Core to use for authenticating users."));
-    setCommitPage(true);
 
     registerField("authentication.backend", ui.backendList);