mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add "Request New Authorization"
Add reauthenticate to general authenticate dialog
This commit is contained in:
@@ -247,11 +247,12 @@ void RiaCloudConnector::setTokenDataFilePath( const QString& filePath )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaCloudConnector::forceNewTokens()
|
void RiaCloudConnector::clearTokens()
|
||||||
{
|
{
|
||||||
if ( m_authCodeFlow )
|
if ( m_authCodeFlow )
|
||||||
{
|
{
|
||||||
m_authCodeFlow->grant();
|
m_authCodeFlow->setToken( "" );
|
||||||
|
m_authCodeFlow->setRefreshToken( "" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,11 +311,23 @@ void RiaCloudConnector::requestTokenWithCancelButton()
|
|||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout( &dialog );
|
QVBoxLayout* layout = new QVBoxLayout( &dialog );
|
||||||
|
|
||||||
QLabel* label = new QLabel( "Requesting token. Please wait..." );
|
QLabel* label =
|
||||||
|
new QLabel( "Requesting token.\nIf this process takes a long time,\nissue a new authentication process by pressing\n'New "
|
||||||
|
"Authentication'\n\n Please wait..." );
|
||||||
|
label->setAlignment( Qt::AlignHCenter );
|
||||||
layout->addWidget( label );
|
layout->addWidget( label );
|
||||||
|
|
||||||
|
// Create horizontal button layout
|
||||||
|
QHBoxLayout* buttonLayout = new QHBoxLayout();
|
||||||
|
|
||||||
|
// Add buttons to horizontal layout
|
||||||
|
QPushButton* requestNewAuthenticationButton = new QPushButton( "New Authentication" );
|
||||||
QPushButton* cancelButton = new QPushButton( "Cancel" );
|
QPushButton* cancelButton = new QPushButton( "Cancel" );
|
||||||
layout->addWidget( cancelButton );
|
buttonLayout->addWidget( requestNewAuthenticationButton );
|
||||||
|
buttonLayout->addWidget( cancelButton );
|
||||||
|
|
||||||
|
// Add button layout to main layout
|
||||||
|
layout->addLayout( buttonLayout );
|
||||||
|
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
timer.setSingleShot( true );
|
timer.setSingleShot( true );
|
||||||
@@ -332,6 +345,14 @@ void RiaCloudConnector::requestTokenWithCancelButton()
|
|||||||
loop.quit();
|
loop.quit();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
connect( requestNewAuthenticationButton,
|
||||||
|
&QPushButton::clicked,
|
||||||
|
[&]()
|
||||||
|
{
|
||||||
|
clearTokens();
|
||||||
|
requestToken();
|
||||||
|
} );
|
||||||
|
|
||||||
connect( &dialog,
|
connect( &dialog,
|
||||||
&QDialog::rejected,
|
&QDialog::rejected,
|
||||||
[&]()
|
[&]()
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
QString requestTokenBlocking();
|
QString requestTokenBlocking();
|
||||||
void requestTokenWithCancelButton();
|
void requestTokenWithCancelButton();
|
||||||
void forceNewTokens();
|
void clearTokens();
|
||||||
|
|
||||||
bool isGranted() const;
|
bool isGranted() const;
|
||||||
|
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ void RimCloudDataSourceCollection::defineUiOrdering( QString uiConfigName, caf::
|
|||||||
text += isGranted ? "<font color='#228B22'>✔ Granted</font>" : "<font color='#FFA500'>❌ Not Granted</font>";
|
text += isGranted ? "<font color='#228B22'>✔ Granted</font>" : "<font color='#FFA500'>❌ Not Granted</font>";
|
||||||
|
|
||||||
m_authenticate.uiCapability()->setUiName( text );
|
m_authenticate.uiCapability()->setUiName( text );
|
||||||
|
m_authenticate.uiCapability()->setUiReadOnly( isGranted );
|
||||||
|
|
||||||
if ( isGranted )
|
if ( isGranted )
|
||||||
{
|
{
|
||||||
@@ -230,15 +231,14 @@ void RimCloudDataSourceCollection::defineEditorAttribute( const caf::PdmFieldHan
|
|||||||
attrib->m_buttonText = "Authenticate";
|
attrib->m_buttonText = "Authenticate";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( field == &m_addDataSources )
|
||||||
if ( field == &m_addDataSources )
|
|
||||||
{
|
{
|
||||||
if ( auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) )
|
if ( auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) )
|
||||||
{
|
{
|
||||||
attrib->m_buttonText = "Add Data Sources(s)";
|
attrib->m_buttonText = "Add Data Sources(s)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( field == &m_addEnsembles )
|
else if ( field == &m_addEnsembles )
|
||||||
{
|
{
|
||||||
if ( auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) )
|
if ( auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user