Remove Storage::getAuthUserName(), including PostgreSQL and SQLite.
Remove the corresponding select_authusername.sql files, too.
This avoids unused code and may avoid confusion in the future. Any
time a username-for-ID is needed, Core::_authUserNames should be
consulted instead.
NOTE: Before using Core::_authUserNames, public functions should be
created and caching should always be done on core startup, instead of
only when --strict-ident mode is enabled.
+++ /dev/null
-SELECT username
-FROM quasseluser
-WHERE userid = :userid
+++ /dev/null
-SELECT username
-FROM quasseluser
-WHERE userid = :userid
return instance()->_storage->setBufferLastSeenMsg(user, bufferId, msgId);
}
return instance()->_storage->setBufferLastSeenMsg(user, bufferId, msgId);
}
- //! Get the auth username associated with a userId
- /** \param user The user to retrieve the username for
- * \return The username for the user
- */
- static inline QString getAuthUserName(UserId user) {
- return instance()->_storage->getAuthUserName(user);
- }
//! Get a usable sysident for the given user in oidentd-strict mode
/** \param user The user to retrieve the sysident for
//! Get a usable sysident for the given user in oidentd-strict mode
/** \param user The user to retrieve the sysident for
-QString PostgreSqlStorage::getAuthUserName(UserId user)
-{
- QString authusername;
- QSqlQuery query(logDb());
- query.prepare(queryString("select_authusername"));
- query.bindValue(":userid", user.toInt());
- safeExec(query);
- watchQuery(query);
-
- if (query.first()) {
- authusername = query.value(0).toString();
- }
- return authusername;
-}
-
// void PostgreSqlStorage::safeExec(QSqlQuery &query) {
// qDebug() << "PostgreSqlStorage::safeExec";
// qDebug() << " executing:\n" << query.executedQuery();
// void PostgreSqlStorage::safeExec(QSqlQuery &query) {
// qDebug() << "PostgreSqlStorage::safeExec";
// qDebug() << " executing:\n" << query.executedQuery();
/* Sysident handling */
QMap<UserId, QString> getAllAuthUserNames() override;
/* Sysident handling */
QMap<UserId, QString> getAllAuthUserNames() override;
- QString getAuthUserName(UserId user) override;
protected:
bool initDbSession(QSqlDatabase &db) override;
protected:
bool initDbSession(QSqlDatabase &db) override;
<file>./SQL/PostgreSQL/select_all_authusernames.sql</file>
<file>./SQL/PostgreSQL/select_authenticator.sql</file>
<file>./SQL/PostgreSQL/select_authuser.sql</file>
<file>./SQL/PostgreSQL/select_all_authusernames.sql</file>
<file>./SQL/PostgreSQL/select_authenticator.sql</file>
<file>./SQL/PostgreSQL/select_authuser.sql</file>
- <file>./SQL/PostgreSQL/select_authusername.sql</file>
<file>./SQL/PostgreSQL/select_bufferByName.sql</file>
<file>./SQL/PostgreSQL/select_bufferExists.sql</file>
<file>./SQL/PostgreSQL/select_buffer_bufferactivities.sql</file>
<file>./SQL/PostgreSQL/select_bufferByName.sql</file>
<file>./SQL/PostgreSQL/select_bufferExists.sql</file>
<file>./SQL/PostgreSQL/select_buffer_bufferactivities.sql</file>
<file>./SQL/SQLite/select_all_authusernames.sql</file>
<file>./SQL/SQLite/select_authenticator.sql</file>
<file>./SQL/SQLite/select_authuser.sql</file>
<file>./SQL/SQLite/select_all_authusernames.sql</file>
<file>./SQL/SQLite/select_authenticator.sql</file>
<file>./SQL/SQLite/select_authuser.sql</file>
- <file>./SQL/SQLite/select_authusername.sql</file>
<file>./SQL/SQLite/select_bufferByName.sql</file>
<file>./SQL/SQLite/select_bufferExists.sql</file>
<file>./SQL/SQLite/select_buffer_bufferactivities.sql</file>
<file>./SQL/SQLite/select_bufferByName.sql</file>
<file>./SQL/SQLite/select_bufferExists.sql</file>
<file>./SQL/SQLite/select_buffer_bufferactivities.sql</file>
-QString SqliteStorage::getAuthUserName(UserId user) {
- QString authusername;
- QSqlQuery query(logDb());
- query.prepare(queryString("select_authusername"));
- query.bindValue(":userid", user.toInt());
-
- lockForRead();
- safeExec(query);
- watchQuery(query);
- unlock();
-
- if (query.first()) {
- authusername = query.value(0).toString();
- }
-
- return authusername;
-}
-
-
QString SqliteStorage::backlogFile()
{
return Quassel::configDirPath() + "quassel-storage.sqlite";
QString SqliteStorage::backlogFile()
{
return Quassel::configDirPath() + "quassel-storage.sqlite";
/* Sysident handling */
QMap<UserId, QString> getAllAuthUserNames() override;
/* Sysident handling */
QMap<UserId, QString> getAllAuthUserNames() override;
- QString getAuthUserName(UserId user) override;
protected:
void setConnectionProperties(const QVariantMap &properties,
protected:
void setConnectionProperties(const QVariantMap &properties,
*/
virtual QMap<UserId, QString> getAllAuthUserNames() = 0;
*/
virtual QMap<UserId, QString> getAllAuthUserNames() = 0;
- //! Get the auth username associated with a userId
- /** \param user The user to retrieve the username for
- * \return The username for the user
- */
- virtual QString getAuthUserName(UserId user) = 0;
-
signals:
//! Sent when a new BufferInfo is created, or an existing one changed somehow.
void bufferInfoUpdated(UserId user, const BufferInfo &);
signals:
//! Sent when a new BufferInfo is created, or an existing one changed somehow.
void bufferInfoUpdated(UserId user, const BufferInfo &);