24#include <QMutexLocker>
26#include "moc_qgsauthconfigurationstorageregistry.cpp"
46 QMutexLocker locker( &mMutex );
48 for (
const auto &s : mStorages )
57 QgsDebugError( QStringLiteral(
"A storage with the same ID (%1) already exists" ).arg(
storage->id() ) );
62 mStorages.emplace_back(
storage );
77 QMutexLocker locker( &mMutex );
79 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
81 if ( ( *it )->id() ==
id )
83 mStorages.erase( it );
95 QMutexLocker locker( &mMutex );
97 QList<QgsAuthConfigurationStorage *> storageList;
98 for (
const auto &s : mStorages )
100 storageList.append( s.get() );
109 QMutexLocker locker( &mMutex );
112 for (
const auto &s : std::as_const( mStorages ) )
114 if ( s->isReady() && s->isEnabled() )
126 QMutexLocker locker( &mMutex );
129 for (
const auto &s : std::as_const( mStorages ) )
131 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
143 QMutexLocker locker( &mMutex );
145 for (
const auto &s : std::as_const( mStorages ) )
147 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
159 QMutexLocker locker( &mMutex );
161 for (
const auto &s : std::as_const( mStorages ) )
176 QMutexLocker locker( &mMutex );
178 std::vector<std::unique_ptr<QgsAuthConfigurationStorage>> orderedStorages;
179 for (
const auto &
id : std::as_const( orderIds ) )
181 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
183 if ( ( *it )->id() ==
id )
185 orderedStorages.push_back( std::move( *it ) );
186 mStorages.erase( it );
193 for (
auto it = std::make_move_iterator( mStorages.begin() ); it != std::make_move_iterator( mStorages.end() ); ++it )
195 orderedStorages.push_back( std::move( *it ) );
198 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