24#include <QMutexLocker>
27#include "moc_qgsauthconfigurationstorageregistry.cpp"
29using namespace Qt::StringLiterals;
49 QMutexLocker locker( &mMutex );
51 for (
const auto &s : mStorages )
65 mStorages.emplace_back(
storage );
80 QMutexLocker locker( &mMutex );
82 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
84 if ( ( *it )->id() ==
id )
86 mStorages.erase( it );
98 QMutexLocker locker( &mMutex );
100 QList<QgsAuthConfigurationStorage *> storageList;
101 for (
const auto &s : mStorages )
103 storageList.append( s.get() );
112 QMutexLocker locker( &mMutex );
115 for (
const auto &s : std::as_const( mStorages ) )
117 if ( s->isReady() && s->isEnabled() )
129 QMutexLocker locker( &mMutex );
132 for (
const auto &s : std::as_const( mStorages ) )
134 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
146 QMutexLocker locker( &mMutex );
148 for (
const auto &s : std::as_const( mStorages ) )
150 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
162 QMutexLocker locker( &mMutex );
164 for (
const auto &s : std::as_const( mStorages ) )
179 QMutexLocker locker( &mMutex );
181 std::vector<std::unique_ptr<QgsAuthConfigurationStorage>> orderedStorages;
182 for (
const auto &
id : std::as_const( orderIds ) )
184 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
186 if ( ( *it )->id() ==
id )
188 orderedStorages.push_back( std::move( *it ) );
189 mStorages.erase( it );
196 for (
auto it = std::make_move_iterator( mStorages.begin() ); it != std::make_move_iterator( mStorages.end() ); ++it )
198 orderedStorages.push_back( std::move( *it ) );
201 mStorages = std::move( orderedStorages );
AuthConfigurationStorageCapability
Authentication configuration storage capabilities.
void storageChanged(const QString &id)
Emitted after a storage was changed.
void setStorageOrder(const QStringList &orderIds)
Order the storages by the specified orderIds.
QgsAuthConfigurationStorage * firstReadyStorageWithCapability(Qgis::AuthConfigurationStorageCapability capability) const
Returns the first ready (and enabled) authentication configuration storage which has the required cap...
bool removeStorage(const QString &id)
Remove the authentication configuration storage identified by id from the registry.
QgsAuthConfigurationStorage * storage(const QString &id) const
Returns the storage with the specified id or nullptr if not found in the registry.
QList< QgsAuthConfigurationStorage * > storages() const
Returns the list of all registered authentication configuration storages.
QgsAuthConfigurationStorageRegistry()
Creates a new QgsAuthConfigurationStorageRegistry instance.
void storageRemoved(const QString &id)
Emitted after a storage was removed.
QList< QgsAuthConfigurationStorage * > readyStoragesWithCapability(Qgis::AuthConfigurationStorageCapability capability) const
Returns the list of all ready (and enabled) authentication configuration storage with the required ca...
void storageAdded(const QString &id)
Emitted after a storage was added.
QList< QgsAuthConfigurationStorage * > readyStorages() const
Returns the list of all ready (and enabled) authentication configuration storage.
~QgsAuthConfigurationStorageRegistry() override
bool addStorage(QgsAuthConfigurationStorage *storage)
Add an authentication configuration storage to the registry.
Abstract class that defines the interface for all authentication configuration storage implementation...
void storageChanged(const QString &id)
Emitted when the storage was updated.
#define QgsDebugError(str)
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS