23#include <QMutexLocker>
43 QMutexLocker locker( &mMutex );
45 for (
const auto &s : mStorages )
59 mStorages.emplace_back(
storage );
74 QMutexLocker locker( &mMutex );
76 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
78 if ( ( *it )->id() == id )
80 mStorages.erase( it );
92 QMutexLocker locker( &mMutex );
94 QList<QgsAuthConfigurationStorage *> storageList;
95 for (
const auto &s : mStorages )
97 storageList.append( s.get() );
106 QMutexLocker locker( &mMutex );
109 for (
const auto &s : std::as_const( mStorages ) )
111 if ( s->isReady() && s->isEnabled() )
123 QMutexLocker locker( &mMutex );
126 for (
const auto &s : std::as_const( mStorages ) )
128 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
140 QMutexLocker locker( &mMutex );
142 for (
const auto &s : std::as_const( mStorages ) )
144 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
156 QMutexLocker locker( &mMutex );
158 for (
const auto &s : std::as_const( mStorages ) )
173 QMutexLocker locker( &mMutex );
175 std::vector<std::unique_ptr<QgsAuthConfigurationStorage>> orderedStorages;
176 for (
const auto &
id : std::as_const( orderIds ) )
178 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
180 if ( ( *it )->id() == id )
182 orderedStorages.push_back( std::move( *it ) );
183 mStorages.erase( it );
190 for (
auto it = std::make_move_iterator( mStorages.begin() ); it != std::make_move_iterator( mStorages.end() ); ++it )
192 orderedStorages.push_back( std::move( *it ) );
195 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.
virtual ~QgsAuthConfigurationStorageRegistry()
QList< QgsAuthConfigurationStorage * > readyStorages() const
Returns the list of all ready (and enabled) authentication configuration storage.
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.
virtual QString id() const =0
Returns the unique identifier of the storage object.
#define QgsDebugError(str)
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS