-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable PGSQL Layer Authentication #5341
Conversation
Add flickable, image, submit button and reformatting hole file. Also fix and injection warning.
fix this warning: onCancel@qrc:/qml/qgismobileapp.qml:3635 Too many arguments, ignoring 1
🎉 Ta-daaa, freshly created APKs are available for 6462267: arm64-android |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
QgsCredentials::setInstance( this ); | ||
} | ||
|
||
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 2 adjacent parameters of 'request' of similar type ('QString &') are easily swapped by mistake [bugprone-easily-swappable-parameters]
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
Additional context
src/core/qfieldappauthrequesthandler.cpp:30: the first parameter in the range is 'username'
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
src/core/qfieldappauthrequesthandler.cpp:30: the last parameter in the range is 'password'
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great functionality!
I did not review in detail or test, just two small things I saw quickly scanning .
Appreciate your quick feedback! I've reviewed and fixed the two items you mentioned, I've committed the changes :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
QgsCredentials::setInstance( this ); | ||
} | ||
|
||
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 2 adjacent parameters of 'request' of similar type ('QString &') are easily swapped by mistake [bugprone-easily-swappable-parameters]
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
Additional context
src/core/qfieldappauthrequesthandler.cpp:30: the first parameter in the range is 'username'
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
src/core/qfieldappauthrequesthandler.cpp:30: the last parameter in the range is 'password'
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
src/core/messagelogmodel.cpp
Outdated
@@ -59,21 +59,43 @@ QVariant MessageLogModel::data( const QModelIndex &index, int role ) const | |||
return QVariant(); | |||
} | |||
|
|||
void MessageLogModel::suppressTags( const QList<QString> &tags ) | |||
void MessageLogModel::suppress( const QVariantMap &model ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void MessageLogModel::suppress( const QVariantMap &model ) | |
void MessageLogModel::suppress( const QVariantMap &filter ) |
src/core/messagelogmodel.cpp
Outdated
} | ||
} | ||
|
||
void MessageLogModel::unsuppressTags( const QList<QString> &tags ) | ||
void MessageLogModel::unsuppress( const QVariantMap &model ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void MessageLogModel::unsuppress( const QVariantMap &model ) | |
void MessageLogModel::unsuppress( const QVariantMap &filter ) |
src/core/messagelogmodel.h
Outdated
@@ -77,7 +77,7 @@ class MessageLogModel : public QAbstractListModel | |||
private: | |||
QgsMessageLog *mMessageLog = nullptr; | |||
QVector<LogMessage> mMessages; | |||
QList<QString> mSuppressedTags; | |||
QMap<QString, QStringList> mSuppressedModel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Model seems off here --
QMap<QString, QStringList> mSuppressedModel; | |
QMap<QString, QStringList> mSuppressedFilters; |
src/core/messagelogmodel.cpp
Outdated
@@ -86,8 +108,16 @@ void MessageLogModel::clear() | |||
|
|||
void MessageLogModel::onMessageReceived( const QString &message, const QString &tag, Qgis::MessageLevel level ) | |||
{ | |||
if ( mSuppressedTags.contains( tag ) || tag == QLatin1String( "3D" ) ) | |||
return; | |||
if ( mSuppressedModel.contains( tag ) || tag == QLatin1String( "3D" ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( mSuppressedModel.contains( tag ) || tag == QLatin1String( "3D" ) ) | |
if ( tag == QLatin1String( "3D" ) | |
{ | |
return; | |
} | |
else if ( mSuppressedModel.contains( tag ) ) |
src/core/messagelogmodel.cpp
Outdated
{ | ||
for ( const QString &filter : mSuppressedModel[tag] ) | ||
{ | ||
if ( message.contains( filter ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's bit a bit more flexible:
if ( message.contains( filter ) ) | |
if ( message.contains( filter, Qt::CaseInsensitive ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
QgsCredentials::setInstance( this ); | ||
} | ||
|
||
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 2 adjacent parameters of 'request' of similar type ('QString &') are easily swapped by mistake [bugprone-easily-swappable-parameters]
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
Additional context
src/core/qfieldappauthrequesthandler.cpp:30: the first parameter in the range is 'username'
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
src/core/qfieldappauthrequesthandler.cpp:30: the last parameter in the range is 'password'
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
QgsCredentials::setInstance( this ); | ||
} | ||
|
||
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 2 adjacent parameters of 'request' of similar type ('QString &') are easily swapped by mistake [bugprone-easily-swappable-parameters]
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
Additional context
src/core/qfieldappauthrequesthandler.cpp:30: the first parameter in the range is 'username'
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
src/core/qfieldappauthrequesthandler.cpp:30: the last parameter in the range is 'password'
bool QFieldAppAuthRequestHandler::request( const QString &realm, QString &username, QString &password, const QString &message )
^
This PR aims to resolve #5285.
Describe: When the username and password for the PGSQL layer are not stored in the project, QField fails to load the layer and displays an "Unsupported" error message. This PR aims to resolve this issue
Fix: By inheritance from
qgscredentials
and overridingrequest
function inQFieldAppAuthRequestHandler
we can add realm tounhandledRealm
byauthNeeded
and that will do the rest.Result: With this fix, when a user attempts to load a PGSQL layer without credentials stored in the project, they will be prompted to enter their username and password. Once authenticated, the layer will be loaded successfully.
New look: