Infinityd.AccountStorage

g GObject.GInterface GObject.GInterface Infinityd.AccountStorage Infinityd.AccountStorage GObject.GInterface->Infinityd.AccountStorage

Implementations:

Infinityd.FilesystemAccountStorage

Methods

account_added (account)

account_removed (account)

get_support ()

list_accounts ()

lookup_accounts (accounts)

lookup_accounts_by_name (name)

remove_account (account)

set_certificate (account, certs)

set_password (account, password)

supports (support)

Virtual Methods

do_account_added (account)

do_account_removed (account)

do_get_support ()

do_list_accounts (n_accounts)

do_lookup_accounts (accounts, n_accounts)

do_lookup_accounts_by_name (name, n_accounts)

do_remove_account (account)

do_set_certificate (account, certs)

do_set_password (account, password)

Properties

None

Signals

Name

Short Description

account-added

This signal is emitted whenever an account has been added to the account storage.

account-removed

This signal is emitted whenever an account has been permanently removed from the storage.

Fields

None

Class Details

class Infinityd.AccountStorage
Bases:

GObject.GInterface

Structure:

Infinityd.AccountStorageInterface

Infinityd.AccountStorage is an opaque data type. You should only access it via the public API functions.

account_added(account)
Parameters:

account (Infinity.AclAccount) – The Infinity.AclAccount that was added to the storage.

Emits the Infinityd.AccountStorage ::account-added signal on self. This should only be used by interface implementations.

account_removed(account)
Parameters:

account (Infinity.AclAccount) – The Infinity.AclAccount with the account information for the removed account.

Emits the Infinityd.AccountStorage ::account-removed signal on self. This should only be used by interface implementations.

get_support()
Returns:

A bitmask of supported operations.

Return type:

Infinityd.AccountStorageSupport

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_UNSUPPORTED will be generated.

list_accounts()
Raises:

GLib.Error

Returns:

An array of Infinity.AclAccount structures with length n_accounts, or None if n_accounts is 0 or error is set. Free with Infinity.AclAccount.array_free().

Return type:

[Infinity.AclAccount] or None

Returns an array of all accounts in self. The length of the array is stored in the output parameter n_accounts. The functions returns None and sets n_accounts to 0 if there are no accounts in self. If there is an error, the function returns None, 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-None error 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:

GLib.Error

Returns:

An array of Infinity.AclAccount structures with n_accounts entries. Free with Infinity.AclAccount.array_free().

Return type:

[Infinity.AclAccount]

Looks up the Infinity.AclAccount structure for all IDs present in accounts. The return value is an array of Infinity.AclAccount structures 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:

GLib.Error

Returns:

An array of Infinity.AclAccount structures with length n_accounts, or None on error or when n_accounts is 0 or error is set. Free with Infinity.AclAccount.array_free().

Return type:

[Infinity.AclAccount]

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 None and sets n_accounts to 0. If an error occurs, None is 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-None error pointer should be passed and checked after the function call.

remove_account(account)
Parameters:

account (int) – The ID of the account to remove.

Raises:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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] or None) – An array of certificates, or None if n_certs is 0.

Raises:

GLib.Error

Returns:

True if the operation was successful or False if an error occurred.

Return type:

bool

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:
  • account (int) – The ID of the account whose password to change.

  • password (str) – The new password for the account, or None.

Raises:

GLib.Error

Returns:

True on success or False on error.

Return type:

bool

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:

True if all operations in support are supported or False otherwise.

Return type:

bool

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) – The Infinity.AclAccount that was added to the storage.

Emits the Infinityd.AccountStorage ::account-added signal on storage. This should only be used by interface implementations.

do_account_removed(account) virtual
Parameters:

account (Infinity.AclAccount) – The Infinity.AclAccount with the account information for the removed account.

Emits the Infinityd.AccountStorage ::account-removed signal on storage. This should only be used by interface implementations.

do_get_support() virtual
Returns:

A bitmask of supported operations.

Return type:

Infinityd.AccountStorageSupport

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_UNSUPPORTED will be generated.

do_list_accounts(n_accounts) virtual
Parameters:

n_accounts (int) –

Return type:

Infinity.AclAccount

do_lookup_accounts(accounts, n_accounts) virtual
Parameters:
  • accounts (int) –

  • n_accounts (int) –

Return type:

Infinity.AclAccount

do_lookup_accounts_by_name(name, n_accounts) virtual
Parameters:
  • name (str) –

  • n_accounts (int) –

Return type:

Infinity.AclAccount

do_remove_account(account) virtual
Parameters:

account (int) – The ID of the account to remove.

Returns:

True on success or False on error.

Return type:

bool

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] or None) – An array of certificates, or None if n_certs is 0.

Returns:

True if the operation was successful or False if an error occurred.

Return type:

bool

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:
  • account (int) – The ID of the account whose password to change.

  • password (str) – The new password for the account, or None.

Returns:

True on success or False on error.

Return type:

bool

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:

RUN_LAST

Parameters:

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.NOTIFICATION support flag.

Infinityd.AccountStorage.signals.account_removed(account_storage, info)
Signal Name:

account-removed

Flags:

RUN_LAST

Parameters:

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.NOTIFICATION support flag.