X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcore.h;h=3eb43132d1d2deceaef87b50cd7c935c7f445690;hb=07473582d22eddd934ee52127cad2baa11943d59;hp=644e9b9720d831758b8762cc948da0a0d5f5d9e6;hpb=d6f3eedebc7f9619b04dffc5f48faa792950fdcd;p=quassel.git diff --git a/src/core/core.h b/src/core/core.h index 644e9b97..3eb43132 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -89,10 +89,21 @@ public: /** * \param userName The user's login name * \param password The user's uncrypted password + * \param authenticator The name of the auth provider service used to log the user in, defaults to "Database". * \return The user's ID if valid; 0 otherwise */ - static inline UserId addUser(const QString &userName, const QString &password) { - return instance()->_storage->addUser(userName, password); + static inline UserId addUser(const QString &userName, const QString &password, const QString &authenticator = "Database") { + return instance()->_storage->addUser(userName, password, authenticator); + } + + //! Does a comparison test against the authenticator in the database and the authenticator currently in use for a UserID. + /** + * \param userid The user's ID (note: not login name). + * \param authenticator The name of the auth provider service used to log the user in, defaults to "Database". + * \return True if the userid was configured with the passed authenticator, false otherwise. + */ + static inline bool checkAuthProvider(const UserId userid, const QString &authenticator) { + return instance()->_storage->getUserAuthenticator(userid) == authenticator; } //! Change a user's password @@ -103,6 +114,13 @@ public: */ static bool changeUserPassword(UserId userId, const QString &password); + //! Check if we can change a user password. + /** + * \param userID The user's ID + * \return true, if we can change their password, false otherwise + */ + static bool canChangeUserPassword(UserId userId); + //! Store a user setting persistently /** * \param userId The users Id @@ -600,10 +618,14 @@ private: void unregisterAuthenticatorBackend(Authenticator *); bool selectBackend(const QString &backend); + bool selectAuthenticator(const QString &backend); bool createUser(); bool saveBackendSettings(const QString &backend, const QVariantMap &settings); void saveAuthBackendSettings(const QString &backend, const QVariantMap &settings); + QVariantMap promptForSettings(const Storage *storage); + QVariantMap promptForSettings(const Authenticator *authenticator); + QVariantMap promptForSettings(QStringList keys, QVariantMap defaults); private: QSet _connectingClients;