Core: in LDAP authenticator, don't try database auth with blank password
[quassel.git] / src / core / core.h
index b5ca2c1..ef04b77 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2018 by the Quassel Project                        *
+ *   Copyright (C) 2005-2019 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -125,6 +125,26 @@ public:
         return instance()->_storage->getUserAuthenticator(userid) == authenticator;
     }
 
+    //! Gets the authenticator configured for a user.
+    /**
+     * \param userName The user's name as a QString.
+     * \return String value corresponding to the user's configure dauthenticator.
+     */
+    static inline QString getUserAuthenticator(const QString& userName)
+    {
+        return instance()->_storage->getUserAuthenticator(instance()->_storage->getUserId(userName));
+    }
+
+    //! Gets the user ID mapped to a username. This is necessary so that non-database auth methods can log in users properly.
+    /**
+     * \param userName The user's name as a QString.
+     * \return userId  The user's ID.
+     */
+    static inline UserId getUserId(const QString& userName)
+    {
+        return instance()->_storage->getUserId(userName);
+    }
+
     //! Change a user's password
     /**
      * \param userId     The user's ID