AccountsService.User

g AccountsService.User AccountsService.User GObject.Object GObject.Object GObject.Object->AccountsService.User

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
  collate (user2)
  get_account_type ()
  get_automatic_login ()
  get_email ()
  get_home_dir ()
  get_icon_file ()
  get_language ()
  get_location ()
  get_locked ()
  get_login_frequency ()
  get_login_history ()
  get_login_time ()
  get_num_sessions ()
  get_num_sessions_anywhere ()
  get_object_path ()
  get_password_expiration_policy (expiration_time, last_change_time, min_days_between_changes, max_days_between_changes, days_to_warn, days_after_expiration_until_lock)
  get_password_hint ()
  get_password_mode ()
  get_primary_session_id ()
  get_real_name ()
  get_saved ()
  get_session ()
  get_session_type ()
  get_shell ()
  get_uid ()
  get_user_name ()
  get_x_session ()
  is_loaded ()
  is_local_account ()
  is_logged_in ()
  is_logged_in_anywhere ()
  is_nonexistent ()
  is_system_account ()
  set_account_type (account_type)
  set_automatic_login (enabled)
  set_email (email)
  set_icon_file (icon_file)
  set_language (language)
  set_location (location)
  set_locked (locked)
  set_password (password, hint)
  set_password_hint (hint)
  set_password_mode (password_mode)
  set_real_name (real_name)
  set_session (session)
  set_session_type (session_type)
  set_user_name (user_name)
  set_x_session (x_session)

Virtual Methods

Inherited:GObject.Object (7)

Properties

Name Type Flags Short Description
account-type int r The account type for this user.
automatic-login bool r Automatic Login
email str r The email address for this user.
home-directory str r The home directory for this user.
icon-file str r The path to an icon for this user.
is-loaded bool r Determines whether or not the user object is loaded and ready to read from.
language str r User’s locale.
local-account bool r Local Account
location str r The location of this user.
locked bool r Locked
login-frequency int r login frequency
login-history GLib.Variant r The login history for this user.
login-time int r The last login time for this user.
nonexistent bool r Determines whether or not the user object represents a valid user account.
password-hint str r Hint to help this user remember his password
password-mode int r The password mode for this user.
real-name str r The real name to display for this user.
shell str r The shell for this user.
system-account bool r System Account
uid int r The UID for this user.
user-name str r The login name for this user.
x-session str r User’s X session.

Signals

Inherited:GObject.Object (1)
Name Short Description
changed Emitted when the user accounts changes in some way.
sessions-changed Emitted when the list of sessions for this user changes.

Fields

Inherited:GObject.Object (1)

Class Details

class AccountsService.User(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:AccountsService.UserClass

Represents a user account on the system.

collate(user2)
Parameters:user2 (AccountsService.User) – a user
Returns:negative if self is before user2, zero if equal or positive if self is after user2
Return type:int

Organize the user by login frequency and names.

get_account_type()
Returns:a AccountsService.UserAccountType
Return type:AccountsService.UserAccountType

Retrieves the account type of self.

get_automatic_login()
Returns:True or False
Return type:bool

Returns whether or not AccountsService.User is automatically logged in at boot time.

get_email()
Returns:a pointer to an array of characters which must not be modified or freed, or None.
Return type:str

Retrieves the email address set by self.

get_home_dir()
Returns:a pointer to an array of characters which must not be modified or freed, or None.
Return type:str

Retrieves the home directory for self.

get_icon_file()
Returns:a path to an icon
Return type:str

Returns the path to the account icon belonging to self.

get_language()
Returns:a path to an icon
Return type:str

Returns the path to the configured locale of self.

get_location()
Returns:a pointer to an array of characters which must not be modified or freed, or None.
Return type:str

Retrieves the location set by self.

get_locked()
Returns:True or False
Return type:bool

Returns whether or not the AccountsService.User account is locked.

get_login_frequency()
Returns:the login frequency
Return type:int

Returns the number of times self has logged in.

get_login_history()
Returns:a pointer to GLib.Variant of type “a(xxa{sv})” which must not be modified or freed, or None.
Return type:GLib.Variant

Returns the login history for self.

get_login_time()
Returns:the login time
Return type:int

Returns the last login time for self.

get_num_sessions()
Returns:the number of sessions
Return type:int

Get the number of sessions for a user that are graphical and on the same seat as the session of the calling process.

get_num_sessions_anywhere()
Returns:the number of sessions
Return type:int

Get the number of sessions for a user on any seat of any type. See also AccountsService.User.get_num_sessions().

(Currently, this function is only implemented for systemd-logind. For ConsoleKit, it is equivalent to AccountsService.User.get_num_sessions.)

get_object_path()
Returns:the object path of the user
Return type:str

Returns the user accounts service object path of self, or None if self doesn’t have an object path associated with it.

get_password_expiration_policy(expiration_time, last_change_time, min_days_between_changes, max_days_between_changes, days_to_warn, days_after_expiration_until_lock)
Parameters:
  • expiration_time (int) – location to write time users password expires
  • last_change_time (int) – location to write time users password was last changed.
  • min_days_between_changes (int) – location to write minimum number of days needed between password changes.
  • max_days_between_changes (int) – location to write maximum number of days password can stay unchanged.
  • days_to_warn (int) – location to write number of days to warn user password is about to expire.
  • days_after_expiration_until_lock (int) – location to write number of days account will be locked after password expires.

Get the password expiration policy for a user.

Note this function is synchronous and ignores errors.

get_password_hint()
Returns:a pointer to an array of characters which must not be modified or freed, or None.
Return type:str

Retrieves the password hint set by self.

get_password_mode()
Returns:a AccountsService.UserPasswordMode
Return type:AccountsService.UserPasswordMode

Retrieves the password mode of self.

get_primary_session_id()
Returns:the id of the primary session of the user
Return type:str

Returns the id of the primary session of self, or None if self has no primary session. The primary session will always be graphical and will be chosen from the sessions on the same seat as the seat of the session of the calling process.

get_real_name()
Returns:a pointer to an array of characters which must not be modified or freed, or None.
Return type:str

Retrieves the display name of self.

get_saved()
Returns:True or False
Return type:bool

Returns whether or not the AccountsService.User account has retained state in accountsservice.

get_session()
Returns:a path to an icon
Return type:str

Returns the path to the configured session for self.

get_session_type()
Returns:a path to an icon
Return type:str

Returns the type of the configured session for self.

get_shell()
Returns:a pointer to an array of characters which must not be modified or freed, or None.
Return type:str

Retrieves the shell assigned to self.

get_uid()
Returns:a pointer to an array of characters which must not be modified or freed, or None.
Return type:int

Retrieves the ID of self.

get_user_name()
Returns:a pointer to an array of characters which must not be modified or freed, or None.
Return type:str

Retrieves the login name of self.

get_x_session()
Returns:a path to an icon
Return type:str

Returns the path to the configured X session for self.

is_loaded()
Returns:True or False
Return type:bool

Determines whether or not the user object is loaded and ready to read from. AccountsService.UserManager :is-loaded property must be True before calling AccountsService.UserManager.list_users()

is_local_account()
Returns:True if the user is local
Return type:bool

Retrieves whether the user is a local account or not.

is_logged_in()
Returns:True or False
Return type:bool

Returns whether or not AccountsService.User is currently graphically logged in on the same seat as the seat of the session of the calling process.

is_logged_in_anywhere()
Returns:True or False
Return type:bool

Returns whether or not AccountsService.User is currently logged in in any way whatsoever. See also AccountsService.User.is_logged_in().

(Currently, this function is only implemented for systemd-logind. For ConsoleKit, it is equivalent to AccountsService.User.is_logged_in.)

is_nonexistent()
Returns:True if the user is nonexistent
Return type:bool

Retrieves whether the user is nonexistent or not.

is_system_account()
Returns:True or False
Return type:bool

Returns whether or not AccountsService.User represents a ‘system account’ like ‘root’ or ‘nobody’.

set_account_type(account_type)
Parameters:account_type (AccountsService.UserAccountType) – a AccountsService.UserAccountType

Changes the account type of self.

Note this function is synchronous and ignores errors.

set_automatic_login(enabled)
Parameters:enabled (bool) – whether or not to autologin for user.

If enabled is set to True then this user will automatically be logged in at boot up time. Only one user can be configured to auto login at any given time, so subsequent calls to AccountsService.User.set_automatic_login() override previous calls.

Note this function is synchronous and ignores errors.

set_email(email)
Parameters:email (str) – an email address

Assigns a new email to self.

Note this function is synchronous and ignores errors.

set_icon_file(icon_file)
Parameters:icon_file (str) – path to an icon

Assigns a new icon for self.

Note this function is synchronous and ignores errors.

set_language(language)
Parameters:language (str) – a locale (e.g. en_US.utf8)

Assigns a new locale for self.

Note this function is synchronous and ignores errors.

set_location(location)
Parameters:location (str) – a location

Assigns a new location for self.

Note this function is synchronous and ignores errors.

set_locked(locked)
Parameters:locked (bool) – whether or not the account is locked

Note this function is synchronous and ignores errors.

set_password(password, hint)
Parameters:
  • password (str) – a password
  • hint (str) – a hint to help user recall password

Changes the password of self to password. hint is displayed to the user if they forget the password.

Note this function is synchronous and ignores errors.

set_password_hint(hint)
Parameters:hint (str) –
set_password_mode(password_mode)
Parameters:password_mode (AccountsService.UserPasswordMode) – a AccountsService.UserPasswordMode

Changes the password of self. If password_mode is AccountsService.UserPasswordMode.SET_AT_LOGIN then the user will be asked for a new password at the next login. If password_mode is AccountsService.UserPasswordMode.NONE then the user will not require a password to log in.

Note this function is synchronous and ignores errors.

set_real_name(real_name)
Parameters:real_name (str) – a new name

Assigns a new name for self.

Note this function is synchronous and ignores errors.

set_session(session)
Parameters:session (str) – a session (e.g. gnome)

Assigns a new session for self.

Note this function is synchronous and ignores errors.

set_session_type(session_type)
Parameters:session_type (str) – a type of session (e.g. “wayland” or “x11”)

Assigns a type to the session for self.

Note this function is synchronous and ignores errors.

set_user_name(user_name)
Parameters:user_name (str) – a new user name

Assigns a new username for self.

Note this function is synchronous and ignores errors.

set_x_session(x_session)
Parameters:x_session (str) – an x session (e.g. gnome)

Assigns a new x session for self.

Note this function is synchronous and ignores errors.

Signal Details

AccountsService.User.signals.changed(user)
Signal Name:changed
Flags:RUN_LAST
Parameters:user (AccountsService.User) – The object which received the signal

Emitted when the user accounts changes in some way.

AccountsService.User.signals.sessions_changed(user)
Signal Name:sessions-changed
Flags:RUN_LAST
Parameters:user (AccountsService.User) – The object which received the signal

Emitted when the list of sessions for this user changes.

Property Details

AccountsService.User.props.account_type
Name:account-type
Type:int
Default Value:0
Flags:READABLE

The account type for this user.

AccountsService.User.props.automatic_login
Name:automatic-login
Type:bool
Default Value:False
Flags:READABLE

Automatic Login

AccountsService.User.props.email
Name:email
Type:str
Default Value:None
Flags:READABLE

The email address for this user.

AccountsService.User.props.home_directory
Name:home-directory
Type:str
Default Value:None
Flags:READABLE

The home directory for this user.

AccountsService.User.props.icon_file
Name:icon-file
Type:str
Default Value:None
Flags:READABLE

The path to an icon for this user.

AccountsService.User.props.is_loaded
Name:is-loaded
Type:bool
Default Value:False
Flags:READABLE

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

AccountsService.User.props.language
Name:language
Type:str
Default Value:None
Flags:READABLE

User’s locale.

AccountsService.User.props.local_account
Name:local-account
Type:bool
Default Value:False
Flags:READABLE

Local Account

AccountsService.User.props.location
Name:location
Type:str
Default Value:None
Flags:READABLE

The location of this user.

AccountsService.User.props.locked
Name:locked
Type:bool
Default Value:False
Flags:READABLE

Locked

AccountsService.User.props.login_frequency
Name:login-frequency
Type:int
Default Value:0
Flags:READABLE

login frequency

AccountsService.User.props.login_history
Name:login-history
Type:GLib.Variant
Default Value:None
Flags:READABLE

The login history for this user.

AccountsService.User.props.login_time
Name:login-time
Type:int
Default Value:0
Flags:READABLE

The last login time for this user.

AccountsService.User.props.nonexistent
Name:nonexistent
Type:bool
Default Value:False
Flags:READABLE

Determines whether or not the user object represents a valid user account.

AccountsService.User.props.password_hint
Name:password-hint
Type:str
Default Value:None
Flags:READABLE

Hint to help this user remember his password

AccountsService.User.props.password_mode
Name:password-mode
Type:int
Default Value:0
Flags:READABLE

The password mode for this user.

AccountsService.User.props.real_name
Name:real-name
Type:str
Default Value:None
Flags:READABLE

The real name to display for this user.

AccountsService.User.props.shell
Name:shell
Type:str
Default Value:None
Flags:READABLE

The shell for this user.

AccountsService.User.props.system_account
Name:system-account
Type:bool
Default Value:False
Flags:READABLE

System Account

AccountsService.User.props.uid
Name:uid
Type:int
Default Value:0
Flags:READABLE

The UID for this user.

AccountsService.User.props.user_name
Name:user-name
Type:str
Default Value:None
Flags:READABLE

The login name for this user.

AccountsService.User.props.x_session
Name:x-session
Type:str
Default Value:None
Flags:READABLE

User’s X session.