19 #include <QFileDialog> 21 #include <QMessageBox> 32 return QColor( 0, 170, 0 );
37 return QColor( 255, 128, 0 );
42 return QColor( 200, 0, 0 );
47 return QColor( 255, 255, 125 );
70 QObject::tr(
"DISABLED. Resources authenticating via the system can not be accessed" ),
103 msg =
QObject::tr(
"Master password cleared (NOTE: network connections may be cached)" );
106 msg =
QObject::tr(
"Master password FAILED to be cleared" );
125 msg =
QObject::tr(
"Master password reset: NO current password hash in database" );
133 bool keepbackup =
false;
138 QgsDebugMsg(
"Master password reset: input canceled by user" );
145 msg =
QObject::tr(
"Master password FAILED to be reset" );
164 QString msg =
QObject::tr(
"Cached authentication configurations for session cleared" );
175 QObject::tr(
"Are you sure you want to remove ALL authentication configurations?\n\n" 176 "Operation can NOT be undone!" ),
177 QMessageBox::Ok | QMessageBox::Cancel,
178 QMessageBox::Cancel ) == QMessageBox::Cancel )
188 msg =
QObject::tr(
"Authentication configurations FAILED to be removed" );
203 QObject::tr(
"Are you sure you want to ERASE the entire authentication database?\n\n" 204 "Operation can NOT be undone!\n\n" 205 "(Current database will be backed up and new one created.)" ),
206 QMessageBox::Ok | QMessageBox::Cancel,
207 QMessageBox::Cancel );
211 if ( btn == QMessageBox::Cancel )
222 msg =
QObject::tr(
"Authentication database FAILED to be erased" );
259 settings.
setValue(
"UI/lastAuthOpenFileDir",
QFileInfo( f ).absoluteDir().path() );
static bool isDisabled(QgsMessageBar *msgbar, int timeout=0)
Verify the authentication system is active, else notify user.
static void resetMasterPassword(QgsMessageBar *msgbar, int timeout=0, QWidget *parent=nullptr)
Reset the cached master password, updating its hash in authentication database and reseting all exist...
static void eraseAuthenticationDatabase(QgsMessageBar *msgbar, int timeout=0, QWidget *parent=nullptr)
Completely clear out the authentication database (configs and master password)
static void fileFound(bool found, QWidget *widget)
Color a widget via a stylesheet if a file path is found or not.
static QgsAuthManager * instance()
Enforce singleton pattern.
static void clearCachedMasterPassword(QgsMessageBar *msgbar, int timeout=0)
Clear the currently cached master password (not its hash in database)
static void removeAuthenticationConfigs(QgsMessageBar *msgbar, int timeout=0, QWidget *parent=nullptr)
Remove all authentication configs.
A bar for displaying non-blocking messages to the user.
static void setMasterPassword(QgsMessageBar *msgbar, int timeout=0)
Sets the cached master password (and verifies it if its hash is in authentication database) ...
static QColor yellowColor()
Yellow color representing caution regarding action.
QString tr(const char *sourceText, const char *disambiguation, int n)
static QColor orangeColor()
Orange color representing loaded component, but not stored in database.
static void clearCachedAuthenticationConfigs(QgsMessageBar *msgbar, int timeout=0)
Clear all cached authentication configs for session.
void setValue(const QString &key, const QVariant &value)
void pushMessage(const QString &text, MessageLevel level=INFO, int duration=5)
convenience method for pushing a message to the bar
static QColor redColor()
Red color representing invalid, untrusted, etc.
static QColor greenColor()
Green color representing valid, trusted, etc.
static QString greenTextStyleSheet(const QString &selector="*")
Green text stylesheet representing valid, trusted, etc.
static QString getOpenFileName(QWidget *parent, const QString &title, const QString &extfilter)
Open file dialog for auth associated widgets.
bool requestMasterPasswordReset(QString *newpass, QString *oldpass, bool *keepbackup)
static QString redTextStyleSheet(const QString &selector="*")
Red text stylesheet representing invalid, untrusted, etc.
QVariant value(const QString &key, const QVariant &defaultValue) const
void clearMasterPassword()
Clear supplied master password.
bool setMasterPassword(bool verify=false)
Main call to initially set or continually check master password is set.
void setScheduledAuthDbErase(bool scheduleErase)
Schedule an optional erase of authentication database, starting when mutex is lockable.
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
Dialog to verify current master password and initiate reset of authentication database with a new pas...
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
static QString orangeTextStyleSheet(const QString &selector="*")
Orange text stylesheet representing loaded component, but not stored in database. ...
void clearAllCachedConfigs()
Clear all authentication configs from authentication method caches.