19#include "moc_qgsauthconfigurationstorageregistry.cpp"
24#include <QMutexLocker>
44 QMutexLocker locker( &mMutex );
46 for (
const auto &s : mStorages )
60 mStorages.emplace_back(
storage );
75 QMutexLocker locker( &mMutex );
77 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
79 if ( ( *it )->id() == id )
81 mStorages.erase( it );
93 QMutexLocker locker( &mMutex );
95 QList<QgsAuthConfigurationStorage *> storageList;
96 for (
const auto &s : mStorages )
98 storageList.append( s.get() );
107 QMutexLocker locker( &mMutex );
110 for (
const auto &s : std::as_const( mStorages ) )
112 if ( s->isReady() && s->isEnabled() )
124 QMutexLocker locker( &mMutex );
127 for (
const auto &s : std::as_const( mStorages ) )
129 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
141 QMutexLocker locker( &mMutex );
143 for (
const auto &s : std::as_const( mStorages ) )
145 if ( s->isReady() && s->isEnabled() && s->capabilities().testFlag( capability ) )
157 QMutexLocker locker( &mMutex );
159 for (
const auto &s : std::as_const( mStorages ) )
174 QMutexLocker locker( &mMutex );
176 std::vector<std::unique_ptr<QgsAuthConfigurationStorage>> orderedStorages;
177 for (
const auto &
id : std::as_const( orderIds ) )
179 for (
auto it = mStorages.begin(); it != mStorages.end(); ++it )
181 if ( ( *it )->id() == id )
183 orderedStorages.push_back( std::move( *it ) );
184 mStorages.erase( it );
191 for (
auto it = std::make_move_iterator( mStorages.begin() ); it != std::make_move_iterator( mStorages.end() ); ++it )
193 orderedStorages.push_back( std::move( *it ) );
196 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