AccountsService.UserManager

g AccountsService.UserManager AccountsService.UserManager GObject.Object GObject.Object GObject.Object->AccountsService.UserManager

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get_default ()

activate_user_session (user)

cache_user (username)

cache_user_async (username, cancellable, callback, *user_data)

cache_user_finish (result)

can_switch ()

create_user (username, fullname, accounttype)

create_user_async (username, fullname, accounttype, cancellable, callback, *user_data)

create_user_finish (result)

delete_user (user, remove_files)

delete_user_async (user, remove_files, cancellable, callback, *user_data)

delete_user_finish (result)

get_user (username)

get_user_by_id (id)

goto_login_session ()

list_users ()

no_service ()

uncache_user (username)

uncache_user_async (username, cancellable, callback, *user_data)

uncache_user_finish (result)

Virtual Methods

Inherited:

GObject.Object (7)

do_user_added (user)

do_user_changed (user)

do_user_is_logged_in_changed (user)

do_user_removed (user)

Properties

Name

Type

Flags

Short Description

exclude-usernames-list

int

r/w

Usernames who are specifically excluded

has-multiple-users

bool

r/w

Whether more than one normal user is present

include-usernames-list

int

r/w

Usernames who are specifically included

is-loaded

bool

r

Determines whether or not the manager object is loaded and ready to read from.

Signals

Inherited:

GObject.Object (1)

Name

Short Description

user-added

Emitted when a user is added to the user manager.

user-changed

One of the users has changed

user-is-logged-in-changed

One of the users has logged in or out.

user-removed

Emitted when a user is removed from the user manager.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

deprecated

object

r

parent

GObject.Object

r

Class Details

class AccountsService.UserManager(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

AccountsService.UserManagerClass

A user manager object.

classmethod get_default()
Returns:

user manager object

Return type:

AccountsService.UserManager

Returns the user manager singleton instance. Calling this function will automatically being loading the user list if it isn’t loaded already. The AccountsService.UserManager :is-loaded property will be set to True when the users are finished loading and then AccountsService.UserManager.list_users() can be called.

activate_user_session(user)
Parameters:

user (AccountsService.User) – the user to activate

Returns:

whether successfully activated

Return type:

bool

Activate the session for a given user.

cache_user(username)
Parameters:

username (str) – a user name

Raises:

GLib.Error

Returns:

user object

Return type:

AccountsService.User

Caches a user account so it shows up via AccountsService.UserManager.list_users().

cache_user_async(username, cancellable, callback, *user_data)
Parameters:

Asynchronously caches a user account so it shows up via AccountsService.UserManager.list_users().

For more details, see AccountsService.UserManager.cache_user(), which is the synchronous version of this call.

New in version 0.6.27.

cache_user_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

user object

Return type:

AccountsService.User

Finishes an asynchronous user caching.

See AccountsService.UserManager.cache_user_async().

New in version 0.6.27.

can_switch()
Returns:

whether we can switch to another session

Return type:

bool

Check whether the user can switch to another session.

create_user(username, fullname, accounttype)
Parameters:
Raises:

GLib.Error

Returns:

user object

Return type:

AccountsService.User

Creates a user account on the system.

create_user_async(username, fullname, accounttype, cancellable, callback, *user_data)
Parameters:

Asynchronously creates a user account on the system.

For more details, see AccountsService.UserManager.create_user(), which is the synchronous version of this call.

New in version 0.6.27.

create_user_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

user object

Return type:

AccountsService.User

Finishes an asynchronous user creation.

See AccountsService.UserManager.create_user_async().

New in version 0.6.27.

delete_user(user, remove_files)
Parameters:
Raises:

GLib.Error

Returns:

True if the user account was successfully deleted

Return type:

bool

Deletes a user account on the system.

delete_user_async(user, remove_files, cancellable, callback, *user_data)
Parameters:

Asynchronously deletes a user account from the system.

For more details, see AccountsService.UserManager.delete_user(), which is the synchronous version of this call.

New in version 0.6.27.

delete_user_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if the user account was successfully deleted

Return type:

bool

Finishes an asynchronous user account deletion.

See AccountsService.UserManager.delete_user_async().

New in version 0.6.27.

get_user(username)
Parameters:

username (str) – the login name of the user to get.

Returns:

AccountsService.User object

Return type:

AccountsService.User

Retrieves a pointer to the AccountsService.User object for the login username from self. Trying to use this object before its AccountsService.User :is-loaded property is True will result in undefined behavior.

get_user_by_id(id)
Parameters:

id (int) – the uid of the user to get.

Returns:

AccountsService.User object

Return type:

AccountsService.User

Retrieves a pointer to the AccountsService.User object for the user with the given uid from self. Trying to use this object before its AccountsService.User :is-loaded property is True will result in undefined behavior.

goto_login_session()
Returns:

whether successful or not

Return type:

bool

Switch the display to the login manager.

list_users()
Returns:

List of AccountsService.User objects

Return type:

[AccountsService.User]

Get a list of system user accounts

no_service()
Returns:

whether or not accounts service is running

Return type:

bool

Check whether or not the accounts service is running.

uncache_user(username)
Parameters:

username (str) – a user name

Raises:

GLib.Error

Returns:

True if successful, otherwise False

Return type:

bool

Releases all metadata about a user account, including icon, language and session. If the user account is from a remote server and the user has never logged in before, then that account will no longer show up in ListCachedUsers() output.

uncache_user_async(username, cancellable, callback, *user_data)
Parameters:
uncache_user_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if the user account was successfully uncached

Return type:

bool

Finishes an asynchronous user uncaching.

See AccountsService.UserManager.uncache_user_async().

New in version 0.6.39.

do_user_added(user) virtual
Parameters:

user (AccountsService.User) –

do_user_changed(user) virtual
Parameters:

user (AccountsService.User) –

do_user_is_logged_in_changed(user) virtual
Parameters:

user (AccountsService.User) –

do_user_removed(user) virtual
Parameters:

user (AccountsService.User) –

Signal Details

AccountsService.UserManager.signals.user_added(user_manager, user)
Signal Name:

user-added

Flags:

RUN_LAST

Parameters:

Emitted when a user is added to the user manager.

AccountsService.UserManager.signals.user_changed(user_manager, user)
Signal Name:

user-changed

Flags:

RUN_LAST

Parameters:

One of the users has changed

AccountsService.UserManager.signals.user_is_logged_in_changed(user_manager, user)
Signal Name:

user-is-logged-in-changed

Flags:

RUN_LAST

Parameters:

One of the users has logged in or out.

AccountsService.UserManager.signals.user_removed(user_manager, user)
Signal Name:

user-removed

Flags:

RUN_LAST

Parameters:

Emitted when a user is removed from the user manager.

Property Details

AccountsService.UserManager.props.exclude_usernames_list
Name:

exclude-usernames-list

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE

Usernames who are specifically excluded

AccountsService.UserManager.props.has_multiple_users
Name:

has-multiple-users

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether more than one normal user is present

AccountsService.UserManager.props.include_usernames_list
Name:

include-usernames-list

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE

Usernames who are specifically included

AccountsService.UserManager.props.is_loaded
Name:

is-loaded

Type:

bool

Default Value:

False

Flags:

READABLE

Determines whether or not the manager object is loaded and ready to read from.