|
KiCad PCB EDA Suite
|
#include <json_common.h>#include <functional>#include <settings/json_settings.h>#include <wx/string.h>#include <map>#include <memory>Go to the source code of this file.
Classes | |
| struct | DATABASE_SOURCE |
| struct | DATABASE_FIELD_MAPPING |
| struct | MAPPABLE_SYMBOL_PROPERTIES |
| struct | DATABASE_LIB_TABLE |
| A database library table will be mapped to a sub-library provided by the database library entry in the KiCad symbol/footprint library table. More... | |
| struct | DATABASE_CACHE_SETTINGS |
| class | DATABASE_LIB_SETTINGS |
| struct | DATABASE_LIB_SETTINGS::LOADED_SCALARS |
| Scalar settings as parsed at load, so Store() can tell which ones the caller changed. More... | |
Typedefs | |
| using | DATABASE_SECRET_LOOKUP = std::function<bool( const wxString& aService, const wxString& aKey, wxString& aSecret )> |
| Keyring lookup signature, matching KIPLATFORM::SECRETS::GetSecretNoPrompt. | |
Enumerations | |
| enum class | DATABASE_SOURCE_TYPE { ODBC , INVALID } |
Functions | |
| KICOMMON_API std::unique_ptr< DATABASE_LIB_SETTINGS > | LoadDatabaseLibSettingsReadOnly (const wxString &aPath, bool *aLoaded=nullptr) |
| Loads a database library settings file without allowing the load itself (e.g. | |
| KICOMMON_API wxString | DefaultDatabaseLibFileName (const wxString &aLibName) |
| KICOMMON_API DATABASE_SECRET_LOOKUP | DefaultDatabaseSecretLookup () |
| The lookup used when none is injected, which must never prompt to unlock the keyring. | |
| KICOMMON_API bool | IsNoPromptSecretLookup (const DATABASE_SECRET_LOOKUP &aLookup) |
| KICOMMON_API bool | GetDatabasePassword (const DATABASE_SOURCE &aSource, std::string &aPassword, const DATABASE_SECRET_LOOKUP &aLookup=nullptr) |
| DSN passwords that are not saved in the (often shared) library file live in the system keyring, keyed by DSN and user name so every library on the same login shares one entry. | |
| KICOMMON_API void | ResolveDatabasePassword (DATABASE_SOURCE &aSource, const DATABASE_SECRET_LOOKUP &aLookup=nullptr) |
| Fills in the source password from the keyring, but only when the library file did not supply one. | |
| KICOMMON_API bool | StoreDatabasePassword (const DATABASE_SOURCE &aSource, const std::string &aPassword) |
| Stores the password for the source's DSN login in the system keyring, or removes the entry when the password is empty. | |
| using DATABASE_SECRET_LOOKUP = std::function<bool( const wxString& aService, const wxString& aKey, wxString& aSecret )> |
Keyring lookup signature, matching KIPLATFORM::SECRETS::GetSecretNoPrompt.
Definition at line 124 of file database_lib_settings.h.
|
strong |
| Enumerator | |
|---|---|
| ODBC | |
| INVALID | |
Definition at line 33 of file database_lib_settings.h.
| KICOMMON_API wxString DefaultDatabaseLibFileName | ( | const wxString & | aLibName | ) |
Definition at line 431 of file database_lib_settings.cpp.
References name, and ReplaceIllegalFileNameChars().
Referenced by DIALOG_DATABASE_LIB_SETTINGS::chooseSavePath().
| KICOMMON_API DATABASE_SECRET_LOOKUP DefaultDatabaseSecretLookup | ( | ) |
The lookup used when none is injected, which must never prompt to unlock the keyring.
Definition at line 451 of file database_lib_settings.cpp.
References KIPLATFORM::SECRETS::GetSecretNoPrompt().
Referenced by GetDatabasePassword().
| KICOMMON_API bool GetDatabasePassword | ( | const DATABASE_SOURCE & | aSource, |
| std::string & | aPassword, | ||
| const DATABASE_SECRET_LOOKUP & | aLookup = nullptr ) |
DSN passwords that are not saved in the (often shared) library file live in the system keyring, keyed by DSN and user name so every library on the same login shares one entry.
| aLookup | replaces the system keyring when set, for tests. |
Definition at line 474 of file database_lib_settings.cpp.
References DefaultDatabaseSecretLookup(), hasKeyringLogin(), passwordService(), and DATABASE_SOURCE::username.
Referenced by ResolveDatabasePassword(), and DIALOG_DATABASE_LIB_SETTINGS::TransferDataToWindow().
| KICOMMON_API bool IsNoPromptSecretLookup | ( | const DATABASE_SECRET_LOOKUP & | aLookup | ) |
Definition at line 457 of file database_lib_settings.cpp.
References KIPLATFORM::SECRETS::GetSecretNoPrompt().
| KICOMMON_API std::unique_ptr< DATABASE_LIB_SETTINGS > LoadDatabaseLibSettingsReadOnly | ( | const wxString & | aPath, |
| bool * | aLoaded = nullptr ) |
Loads a database library settings file without allowing the load itself (e.g.
a schema migration) to write back to disk. Callers must SetReadOnly( false ) around an explicit save.
| aLoaded | is set to false when the file exists but could not be read; saving such settings would replace the file with defaults |
Definition at line 411 of file database_lib_settings.cpp.
References FILEEXT::DatabaseLibraryFileExtension, and path.
Referenced by BOOST_AUTO_TEST_CASE().
| KICOMMON_API void ResolveDatabasePassword | ( | DATABASE_SOURCE & | aSource, |
| const DATABASE_SECRET_LOOKUP & | aLookup = nullptr ) |
Fills in the source password from the keyring, but only when the library file did not supply one.
Definition at line 491 of file database_lib_settings.cpp.
References GetDatabasePassword(), and DATABASE_SOURCE::password.
Referenced by DATABASE_LIB_SETTINGS::ResolvePassword().
| KICOMMON_API bool StoreDatabasePassword | ( | const DATABASE_SOURCE & | aSource, |
| const std::string & | aPassword ) |
Stores the password for the source's DSN login in the system keyring, or removes the entry when the password is empty.
Definition at line 498 of file database_lib_settings.cpp.
References KIPLATFORM::SECRETS::DeleteSecret(), hasKeyringLogin(), passwordService(), KIPLATFORM::SECRETS::StoreSecret(), and DATABASE_SOURCE::username.
Referenced by DIALOG_DATABASE_LIB_SETTINGS::TransferDataFromWindow().