Navigation Menu

Skip to content

Commit

Permalink
[auth] Menu option and configuration for auto clear auth cache
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Oct 23, 2017
1 parent cde36f3 commit 1ecdb1d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/gui/auth/qgsautheditorwidgets.cpp
Expand Up @@ -26,6 +26,7 @@
#include "qgsauthcertificatemanager.h"
#include "qgsauthguiutils.h"
#include "qgsauthmanager.h"
#include "qgsnetworkaccessmanager.h"


QgsAuthMethodPlugins::QgsAuthMethodPlugins( QWidget *parent )
Expand Down Expand Up @@ -147,6 +148,11 @@ void QgsAuthEditorWidgets::setupUtilitiesMenu()
mActionRemoveAuthConfigs = new QAction( QStringLiteral( "Remove all authentication configurations" ), this );
mActionEraseAuthDatabase = new QAction( QStringLiteral( "Erase authentication database" ), this );

mActionClearAccessCacheNow = new QAction( QStringLiteral( "Clear network authentication access cache" ), this );
mActionAutoClearAccessCache = new QAction( QStringLiteral( "Automatically clear network authentication access cache on SSL errors" ), this );
mActionAutoClearAccessCache->setCheckable( true );
mActionAutoClearAccessCache->setChecked( QgsSettings().value( QStringLiteral( "clear_auth_cache_on_errors" ), false, QgsSettings::Section::Auth ).toBool( ) );

mActionPasswordHelperSync = new QAction( tr( "Store/update the master password in your %1" )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ), this );
mActionPasswordHelperDelete = new QAction( tr( "Clear the master password from your %1" )
Expand All @@ -173,11 +179,24 @@ void QgsAuthEditorWidgets::setupUtilitiesMenu()
connect( mActionPasswordHelperEnable, &QAction::triggered, this, &QgsAuthEditorWidgets::passwordHelperEnableTriggered );
connect( mActionPasswordHelperLoggingEnable, &QAction::triggered, this, &QgsAuthEditorWidgets::passwordHelperLoggingEnableTriggered );

connect( mActionClearAccessCacheNow, &QAction::triggered, this, [ = ]
{
QgsNetworkAccessManager::instance()->clearAccessCache();
messageBar()->pushSuccess( tr( "Auth cache cleared" ), tr( "Network authentication cache has been cleared" ) );
} );
connect( mActionAutoClearAccessCache, &QAction::triggered, this, [ ]( bool checked )
{
QgsSettings().setValue( QStringLiteral( "clear_auth_cache_on_errors" ), checked, QgsSettings::Section::Auth );
} );

mAuthUtilitiesMenu = new QMenu( this );
mAuthUtilitiesMenu->addAction( mActionSetMasterPassword );
mAuthUtilitiesMenu->addAction( mActionClearCachedMasterPassword );
mAuthUtilitiesMenu->addAction( mActionResetMasterPassword );
mAuthUtilitiesMenu->addSeparator();
mAuthUtilitiesMenu->addAction( mActionClearAccessCacheNow );
mAuthUtilitiesMenu->addAction( mActionAutoClearAccessCache );
mAuthUtilitiesMenu->addSeparator();
mAuthUtilitiesMenu->addAction( mActionPasswordHelperEnable );
mAuthUtilitiesMenu->addAction( mActionPasswordHelperSync );
mAuthUtilitiesMenu->addAction( mActionPasswordHelperDelete );
Expand Down
2 changes: 2 additions & 0 deletions src/gui/auth/qgsautheditorwidgets.h
Expand Up @@ -120,6 +120,8 @@ class GUI_EXPORT QgsAuthEditorWidgets : public QWidget, private Ui::QgsAuthEdito
QAction *mActionPasswordHelperSync = nullptr;
QAction *mActionPasswordHelperEnable = nullptr;
QAction *mActionPasswordHelperLoggingEnable = nullptr;
QAction *mActionClearAccessCacheNow = nullptr;
QAction *mActionAutoClearAccessCache = nullptr;
};

#endif // QGSAUTHEDITORWIDGETS_H

0 comments on commit 1ecdb1d

Please sign in to comment.