24#include <QMutexLocker>
27#include "moc_qgsauthconfigurationstorageregistry.cpp"
29using namespace Qt::StringLiterals;
46 QMutexLocker locker( &mMutex );
48 for (
const auto &s : mStorages )
62 mStorages.emplace_back(
storage );
76 QMutexLocker locker( &mMutex );
78 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
80 if ( ( *it )->id() ==
id )
82 mStorages.erase( it );
93 QMutexLocker locker( &mMutex );
95 QList<QgsAuthConfigurationStorage *> storageList;
96 for (
const auto &s : mStorages )
98 storageList.append( s.get() );
106 QMutexLocker locker( &mMutex );
109 for (
const auto &s : std::as_const( mStorages ) )
111 if ( s->isReady() && s->isEnabled() )
122 QMutexLocker locker( &mMutex );
125 for (
const auto &s : std::as_const( mStorages ) )
127 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
138 QMutexLocker locker( &mMutex );
140 for (
const auto &s : std::as_const( mStorages ) )
142 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
152 QMutexLocker locker( &mMutex );
154 for (
const auto &s : std::as_const( mStorages ) )
168 QMutexLocker locker( &mMutex );
170 std::vector<std::unique_ptr<QgsAuthConfigurationStorage>> orderedStorages;
171 for (
const auto &
id : std::as_const( orderIds ) )
173 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
175 if ( ( *it )->id() ==
id )
177 orderedStorages.push_back( std::move( *it ) );
178 mStorages.erase( it );
185 for (
auto it = std::make_move_iterator( mStorages.begin() ); it != std::make_move_iterator( mStorages.end() ); ++it )
187 orderedStorages.push_back( std::move( *it ) );
190 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