Skip to content

Commit

Permalink
[auth] Redesign Authentication section of Options
Browse files Browse the repository at this point in the history
- Separate management options from auth config table
- Add standalone certificate manager
- Add installed auth method plugin dialog, indicating usage per plugin
  • Loading branch information
dakcarto committed Sep 24, 2015
1 parent b6459b0 commit 0975c9f
Show file tree
Hide file tree
Showing 14 changed files with 766 additions and 110 deletions.
25 changes: 25 additions & 0 deletions python/gui/auth/qgsauthcertificatemanager.sip
@@ -0,0 +1,25 @@
class QgsAuthCertEditors : QWidget
{
%TypeHeaderCode
#include <qgsauthcertificatemanager.h>
%End

public:
explicit QgsAuthCertEditors( QWidget *parent /TransferThis/ = 0 );

~QgsAuthCertEditors();
};

class QgsAuthCertManager : QDialog
{
%TypeHeaderCode
#include <qgsauthcertificatemanager.h>
%End

public:
explicit QgsAuthCertManager( QWidget *parent /TransferThis/ = 0 );

~QgsAuthCertManager();

QgsAuthCertEditors *certEditorsWidget();
};
7 changes: 6 additions & 1 deletion python/gui/auth/qgsauthconfigeditor.sip
Expand Up @@ -5,9 +5,14 @@ class QgsAuthConfigEditor : QWidget
%End

public:
explicit QgsAuthConfigEditor( QWidget *parent /TransferThis/ = 0 );
explicit QgsAuthConfigEditor( QWidget *parent /TransferThis/ = 0, bool showUtilities = true, QgsMessageBar *msgbar /TransferThis/ = 0 );
~QgsAuthConfigEditor();

void toggleTitleVisibility( bool visible );

public slots:

void showUtilitiesButton( bool show = true );

void setMessageBar( QgsMessageBar *msgbar /TransferThis/ = 0 );
};
15 changes: 13 additions & 2 deletions python/gui/auth/qgsautheditorwidgets.sip
@@ -1,3 +1,16 @@
class QgsAuthMethodPlugins : QDialog
{
%TypeHeaderCode
#include <qgsautheditorwidgets.h>
%End

public:
explicit QgsAuthMethodPlugins( QWidget *parent /TransferThis/ = 0 );

~QgsAuthMethodPlugins();
};


class QgsAuthEditorWidgets : QWidget
{
%TypeHeaderCode
Expand All @@ -8,6 +21,4 @@ class QgsAuthEditorWidgets : QWidget
explicit QgsAuthEditorWidgets( QWidget *parent /TransferThis/ = 0 );

~QgsAuthEditorWidgets();

QTabWidget * tabbedWidget();
};
1 change: 1 addition & 0 deletions python/gui/gui.sip
Expand Up @@ -143,6 +143,7 @@

%Include auth/qgsauthauthoritieseditor.sip
%Include auth/qgsauthcertificateinfo.sip
%Include auth/qgsauthcertificatemanager.sip
%Include auth/qgsauthcerttrustpolicycombobox.sip
%Include auth/qgsauthconfigeditor.sip
%Include auth/qgsauthconfigselect.sip
Expand Down
4 changes: 4 additions & 0 deletions src/gui/CMakeLists.txt
Expand Up @@ -61,10 +61,12 @@ SET(QGIS_GUI_SRCS

auth/qgsauthauthoritieseditor.cpp
auth/qgsauthcertificateinfo.cpp
auth/qgsauthcertificatemanager.cpp
auth/qgsauthcerttrustpolicycombobox.cpp
auth/qgsauthconfigedit.cpp
auth/qgsauthconfigeditor.cpp
auth/qgsauthconfigselect.cpp
auth/qgsautheditorwidgets.cpp
auth/qgsauthguiutils.cpp
auth/qgsauthidentitieseditor.cpp
auth/qgsauthimportcertdialog.cpp
Expand Down Expand Up @@ -444,6 +446,7 @@ SET(QGIS_GUI_MOC_HDRS

auth/qgsauthauthoritieseditor.h
auth/qgsauthcertificateinfo.h
auth/qgsauthcertificatemanager.h
auth/qgsauthcerttrustpolicycombobox.h
auth/qgsauthconfigedit.h
auth/qgsauthconfigeditor.h
Expand Down Expand Up @@ -560,6 +563,7 @@ SET(QGIS_GUI_HDRS

auth/qgsauthauthoritieseditor.h
auth/qgsauthcertificateinfo.h
auth/qgsauthcertificatemanager.h
auth/qgsauthcerttrustpolicycombobox.h
auth/qgsauthconfigedit.h
auth/qgsauthconfigeditor.h
Expand Down
56 changes: 56 additions & 0 deletions src/gui/auth/qgsauthcertificatemanager.cpp
@@ -0,0 +1,56 @@
/***************************************************************************
qgsauthcertificatemanager.cpp
---------------------
begin : September, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsauthcertificatemanager.h"

#include <QDialog>
#include <QDialogButtonBox>
#include <QPushButton>

QgsAuthCertEditors::QgsAuthCertEditors( QWidget *parent )
: QWidget( parent )
{
setupUi( this );
}

QgsAuthCertEditors::~QgsAuthCertEditors()
{
}



QgsAuthCertManager::QgsAuthCertManager( QWidget *parent )
: QDialog( parent )
{
setWindowTitle( tr( "Certificate Manager" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 6 );

mCertEditors = new QgsAuthCertEditors( this );
layout->addWidget( mCertEditors );

QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Close,
Qt::Horizontal, this );
buttonBox->button( QDialogButtonBox::Close )->setDefault( true );
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) );
layout->addWidget( buttonBox );

setLayout( layout );
}

QgsAuthCertManager::~QgsAuthCertManager()
{
}
69 changes: 69 additions & 0 deletions src/gui/auth/qgsauthcertificatemanager.h
@@ -0,0 +1,69 @@
/***************************************************************************
qgsauthcertificatemanager.h
---------------------
begin : September, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSAUTHCERTIFICATEMANAGER_H
#define QGSAUTHCERTIFICATEMANAGER_H

#include "ui_qgsauthcertificatemanager.h"

#include <QWidget>
#include <QDialog>


/** \ingroup gui
* Wrapper widget to manage available certificate editors
*/
class GUI_EXPORT QgsAuthCertEditors : public QWidget, private Ui::QgsAuthCertManager
{
Q_OBJECT

public:
/**
* Construct a widget to contain various certificate editors
* @param parent Parent widget
*/
explicit QgsAuthCertEditors( QWidget *parent = 0 );

~QgsAuthCertEditors();
};


//////////////// Embed in dialog ///////////////////

/** \ingroup gui
* Dialog wrapper for widget to manage available certificate editors
*/
class GUI_EXPORT QgsAuthCertManager : public QDialog
{
Q_OBJECT

public:
/**
* Construct a dialog wrapper for widget to manage available certificate editors
* @param parent Parent widget
*/
explicit QgsAuthCertManager( QWidget *parent = 0 );

~QgsAuthCertManager();

/** Get access to embedded editors widget */
QgsAuthCertEditors *certEditorsWidget() { return mCertEditors; }

private:
QgsAuthCertEditors *mCertEditors;
};

#endif // QGSAUTHCERTIFICATEMANAGER_H
21 changes: 20 additions & 1 deletion src/gui/auth/qgsauthconfigeditor.cpp
Expand Up @@ -26,7 +26,7 @@
#include "qgsauthconfigedit.h"
#include "qgsauthguiutils.h"

QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent )
QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent, bool showUtilities, QgsMessageBar *msgbar )
: QWidget( parent )
, mConfigModel( 0 )
, mAuthUtilitiesMenu( 0 )
Expand All @@ -49,6 +49,10 @@ QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent )
else
{
setupUi( this );

setMessageBar( msgbar );
showUtilitiesButton( showUtilities );

mConfigModel = new QSqlTableModel( this, QgsAuthManager::instance()->authDbConnection() );
mConfigModel->setTable( QgsAuthManager::instance()->authDbConfigTable() );
mConfigModel->select();
Expand Down Expand Up @@ -113,6 +117,7 @@ QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent )
mAuthUtilitiesMenu->addAction( mActionEraseAuthDatabase );

btnAuthUtilities->setMenu( mAuthUtilitiesMenu );
lblAuthConfigDb->setVisible( false );
}
}

Expand Down Expand Up @@ -164,6 +169,20 @@ void QgsAuthConfigEditor::toggleTitleVisibility( bool visible )
}
}

void QgsAuthConfigEditor::showUtilitiesButton( bool show )
{
btnAuthUtilities->setVisible( show );
}

void QgsAuthConfigEditor::setMessageBar( QgsMessageBar *msgbar )
{
if ( msgbar )
{
delete mMsgBar;
mMsgBar = msgbar;
}
}

void QgsAuthConfigEditor::refreshTableView()
{
mConfigModel->select();
Expand Down
11 changes: 10 additions & 1 deletion src/gui/auth/qgsauthconfigeditor.h
Expand Up @@ -35,13 +35,22 @@ class GUI_EXPORT QgsAuthConfigEditor : public QWidget, private Ui::QgsAuthConfig
public:
/**
* Widget for editing authentication configurations directly in database
* @param showUtilities Whether to show the widget's utilities button
* @param msgbar Substitute internal message bar for another
*/
explicit QgsAuthConfigEditor( QWidget *parent = 0 );
explicit QgsAuthConfigEditor( QWidget *parent = 0, bool showUtilities = true, QgsMessageBar *msgbar = 0 );
~QgsAuthConfigEditor();

/** Hide the widget's title, e.g. when embedding */
void toggleTitleVisibility( bool visible );

public slots:
/** Whether to show the widget's utilities button, e.g. when embedding */
void showUtilitiesButton( bool show = true );

/** Substitute internal message bar for another, e.g. when embedding */
void setMessageBar( QgsMessageBar *msgbar = 0 );

private slots:
/** Repopulate the view with table contents */
void refreshTableView();
Expand Down

0 comments on commit 0975c9f

Please sign in to comment.