Infinityd.AccountStorage¶
- Implementations:
 
Methods¶
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Properties¶
None
Signals¶
Name  | 
Short Description  | 
|---|---|
This signal is emitted whenever an account has been added to the account storage.  | 
|
This signal is emitted whenever an account has been permanently removed from the storage.  | 
Fields¶
None
Class Details¶
- class Infinityd.AccountStorage¶
 - Bases:
 - Structure:
 
Infinityd.AccountStorageis an opaque data type. You should only access it via the public API functions.- account_added(account)¶
 - Parameters:
 account (
Infinity.AclAccount) – TheInfinity.AclAccountthat was added to the storage.
Emits the
Infinityd.AccountStorage::account-addedsignal on self. This should only be used by interface implementations.
- account_removed(account)¶
 - Parameters:
 account (
Infinity.AclAccount) – TheInfinity.AclAccountwith the account information for the removed account.
Emits the
Infinityd.AccountStorage::account-removedsignal on self. This should only be used by interface implementations.
- get_support()¶
 - Returns:
 A bitmask of supported operations.
- Return type:
 
Returns a bitmask of operations supported by the account storage backend. If unsupported operations are attempted on self, an error with code
Infinity.DirectoryError.OPERATION_UNSUPPORTEDwill be generated.
- list_accounts()¶
 - Raises:
 - Returns:
 An array of
Infinity.AclAccountstructures with length n_accounts, orNoneif n_accounts is 0 or error is set. Free withInfinity.AclAccount.array_free().- Return type:
 [
Infinity.AclAccount] orNone
Returns an array of all accounts in self. The length of the array is stored in the output parameter n_accounts. The functions returns
Noneand sets n_accounts to 0 if there are no accounts in self. If there is an error, the function returnsNone, n_accounts is undefined, and error is set. Therefore, to reliably find out whether an error occurred or whether there are really no accounts present, a non-Noneerror pointer should be passed and checked after the function call.Note that this function might not be supported by the backend. See
Infinityd.AccountStorage.get_support().
- lookup_accounts(accounts)¶
 - Parameters:
 accounts ([
int]) – An array of #InfAclAccountId s to look up.- Raises:
 - Returns:
 An array of
Infinity.AclAccountstructures with n_accounts entries. Free withInfinity.AclAccount.array_free().- Return type:
 
Looks up the
Infinity.AclAccountstructure for all IDs present in accounts. The return value is an array ofInfinity.AclAccountstructures which is in the same order as the accounts array. If an element in the output array has the Infinity.AclAccount.id field set to 0, it means that the account with the corresponding ID in the accounts array does not exist in self.
- lookup_accounts_by_name(name)¶
 - Parameters:
 name (
str) – The name to look up.- Raises:
 - Returns:
 An array of
Infinity.AclAccountstructures with length n_accounts, orNoneon error or when n_accounts is 0 or error is set. Free withInfinity.AclAccount.array_free().- Return type:
 
This function performs the “reverse” lookup: Given an account name, the function returns an array with all accounts that have this name. Many backends make sure that there cannot be duplicated names, in which case this can at most return one account, however in principle accounts with the same name are supported.
If there is no account with the given name, the function returns
Noneand sets n_accounts to 0. If an error occurs,Noneis returned, n_accounts is undefined, and error is set. Therefore, to reliably find out whether a lookup error occurred or this is no account with the given name, a non-Noneerror pointer should be passed and checked after the function call.
- remove_account(account)¶
 - Parameters:
 account (
int) – The ID of the account to remove.- Raises:
 - Returns:
 - Return type:
 
Removes the account with the given ID from self.
Note that this function might not be supported by the backend. See
Infinityd.AccountStorage.get_support().
- set_certificate(account, certs)¶
 - Parameters:
 account (
int) – The ID of the account whose certificate to set.certs ([
InfGnutls.X509Crt] orNone) – An array of certificates, orNoneif n_certs is 0.
- Raises:
 - Returns:
 Trueif the operation was successful orFalseif an error occurred.- Return type:
 
Changes the certificate(s) associated to the account with ID account. All certificates that are currently associated to it are removed, and the given certificates are associated instead. If n_certs is 0, there will be no associated certificates and login by certificate will be disabled for account.
Note that this function might not be supported by the backend. See
Infinityd.AccountStorage.get_support().
- set_password(account, password)¶
 - Parameters:
 - Raises:
 - Returns:
 - Return type:
 
Changes the password for the account with the given ID. If this call succeeds, the new password will have to be provided to infd_account_storage_login_by_password() for the login to succeed. If password is
None, the password will be unset and login by password will no longer be possible.Note that this function might not be supported by the backend. See
Infinityd.AccountStorage.get_support().
- supports(support)¶
 - Parameters:
 support (
Infinityd.AccountStorageSupport) – A bitmask of operations to test.- Returns:
 Trueif all operations in support are supported orFalseotherwise.- Return type:
 
Checks whether support for all operations specified in support is available for self. This is equivalent to calling
Infinityd.AccountStorage.get_support() and testing the returned value for containing the bits in support.
- do_account_added(account) virtual¶
 - Parameters:
 account (
Infinity.AclAccount) – TheInfinity.AclAccountthat was added to the storage.
Emits the
Infinityd.AccountStorage::account-addedsignal on storage. This should only be used by interface implementations.
- do_account_removed(account) virtual¶
 - Parameters:
 account (
Infinity.AclAccount) – TheInfinity.AclAccountwith the account information for the removed account.
Emits the
Infinityd.AccountStorage::account-removedsignal on storage. This should only be used by interface implementations.
- do_get_support() virtual¶
 - Returns:
 A bitmask of supported operations.
- Return type:
 
Returns a bitmask of operations supported by the account storage backend. If unsupported operations are attempted on storage, an error with code
Infinity.DirectoryError.OPERATION_UNSUPPORTEDwill be generated.
- do_list_accounts(n_accounts) virtual¶
 - Parameters:
 n_accounts (
int) –- Return type:
 
Virtual function to obtain a list of all available accounts. Can be
Noneif not supported by the backend.
- do_lookup_accounts(accounts, n_accounts) virtual¶
 - Parameters:
 - Return type:
 
Virtual function to look up account by their identifier.
- do_lookup_accounts_by_name(name, n_accounts) virtual¶
 - Parameters:
 - Return type:
 
Virtual function to reverse-lookup an account identifier when given the account name.
- do_remove_account(account) virtual¶
 - Parameters:
 account (
int) – The ID of the account to remove.- Returns:
 - Return type:
 
Removes the account with the given ID from storage.
Note that this function might not be supported by the backend. See
Infinityd.AccountStorage.get_support().
- do_set_certificate(account, certs) virtual¶
 - Parameters:
 account (
int) – The ID of the account whose certificate to set.certs ([
InfGnutls.X509Crt] orNone) – An array of certificates, orNoneif n_certs is 0.
- Returns:
 Trueif the operation was successful orFalseif an error occurred.- Return type:
 
Changes the certificate(s) associated to the account with ID account. All certificates that are currently associated to it are removed, and the given certificates are associated instead. If n_certs is 0, there will be no associated certificates and login by certificate will be disabled for account.
Note that this function might not be supported by the backend. See
Infinityd.AccountStorage.get_support().
- do_set_password(account, password) virtual¶
 - Parameters:
 - Returns:
 - Return type:
 
Changes the password for the account with the given ID. If this call succeeds, the new password will have to be provided to infd_account_storage_login_by_password() for the login to succeed. If password is
None, the password will be unset and login by password will no longer be possible.Note that this function might not be supported by the backend. See
Infinityd.AccountStorage.get_support().
Signal Details¶
- Infinityd.AccountStorage.signals.account_added(account_storage, info)¶
 - Signal Name:
 account-added- Flags:
 - Parameters:
 account_storage (
Infinityd.AccountStorage) – The object which received the signalinfo (
Infinity.AclAccount) – TheInfinity.AclAccountcontaining the account ID and account name of the added account.
This signal is emitted whenever an account has been added to the account storage. However, the signal is only emitted if the storage implementations supports the
Infinityd.AccountStorageSupport.NOTIFICATIONsupport flag.
- Infinityd.AccountStorage.signals.account_removed(account_storage, info)¶
 - Signal Name:
 account-removed- Flags:
 - Parameters:
 account_storage (
Infinityd.AccountStorage) – The object which received the signalinfo (
Infinity.AclAccount) – TheInfinity.AclAccountcontaining the account ID and account name of the removed account.
This signal is emitted whenever an account has been permanently removed from the storage. However, the signal is only emitted if the storage implementations supports the
Infinityd.AccountStorageSupport.NOTIFICATIONsupport flag.