AccountsService.User¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
The account type for this user. |
||
r |
Automatic Login |
||
r |
The email address for this user. |
||
r |
The home directory for this user. |
||
r |
The path to an icon for this user. |
||
r |
Determines whether or not the user object is loaded and ready to read from. |
||
r |
User’s locale. |
||
r |
Local Account |
||
r |
The location of this user. |
||
r |
Locked |
||
r |
login frequency |
||
r |
The login history for this user. |
||
r |
The last login time for this user. |
||
r |
Determines whether or not the user object represents a valid user account. |
||
r |
Hint to help this user remember his password |
||
r |
The password mode for this user. |
||
r |
The real name to display for this user. |
||
r |
The shell for this user. |
||
r |
System Account |
||
r |
The UID for this user. |
||
r |
The login name for this user. |
||
r |
User’s X session. |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when the user accounts changes in some way. |
|
Emitted when the list of sessions for this user changes. |
Fields¶
- Inherited:
Class Details¶
- class AccountsService.User(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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:
Organize the user by login frequency and names.
- get_account_type()¶
- Returns:
- Return type:
Retrieves the account type of self.
- get_automatic_login()¶
-
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:
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:
Retrieves the home directory for self.
- get_icon_file()¶
- Returns:
a path to an icon
- Return type:
Returns the path to the account icon belonging to self.
- get_language()¶
- Returns:
the user’s language, or the empty string if they are using the system default language, or
None
if there is no connection to the daemon- Return type:
Returns the value of
AccountsService.User
:language
.
- get_languages()¶
- Returns:
the user’s preferred languages, or the empty string if they are using the system default language, or
None
if there is no connection to the daemon- Return type:
Returns the value of
AccountsService.User
:languages
.
- get_location()¶
- Returns:
a pointer to an array of characters which must not be modified or freed, or
None
.- Return type:
Retrieves the location set by self.
- get_locked()¶
-
Returns whether or not the
AccountsService.User
account is locked.
- get_login_frequency()¶
- Returns:
the login frequency
- Return type:
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, orNone
.- Return type:
Returns the login history for self.
- get_num_sessions()¶
- Returns:
the number of sessions
- Return type:
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:
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:
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()¶
- Returns:
- expiration_time:
location to write time users password expires
- last_change_time:
location to write time users password was last changed.
- min_days_between_changes:
location to write minimum number of days needed between password changes.
- max_days_between_changes:
location to write maximum number of days password can stay unchanged.
- days_to_warn:
location to write number of days to warn user password is about to expire.
- days_after_expiration_until_lock:
location to write number of days account will be locked after password expires.
- Return type:
(expiration_time:
int
, last_change_time:int
, min_days_between_changes:int
, max_days_between_changes:int
, days_to_warn:int
, days_after_expiration_until_lock:int
)
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:
Retrieves the password hint set by self.
- get_password_mode()¶
- Returns:
- Return type:
Retrieves the password mode of self.
- get_primary_session_id()¶
- Returns:
the id of the primary session of the user
- Return type:
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:
Retrieves the display name of self.
- get_saved()¶
-
Returns whether or not the
AccountsService.User
account has retained state in accountsservice.
- get_session()¶
- Returns:
a path to an icon
- Return type:
Returns the path to the configured session for self.
- get_session_type()¶
- Returns:
a path to an icon
- Return type:
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:
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:
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:
Retrieves the login name of self.
- get_x_session()¶
- Returns:
a path to an icon
- Return type:
Returns the path to the configured X session for self.
- is_loaded()¶
-
Determines whether or not the user object is loaded and ready to read from.
AccountsService.UserManager
:is-loaded
property must beTrue
before callingAccountsService.UserManager.list_users
()
- is_local_account()¶
-
Retrieves whether the user is a local account or not.
- is_logged_in()¶
-
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 whether or not
AccountsService.User
is currently logged in in any way whatsoever. See alsoAccountsService.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()¶
-
Retrieves whether the user is nonexistent or not.
- is_system_account()¶
-
Returns whether or not
AccountsService.User
represents a ‘system account’ like ‘root’ or ‘nobody’.
- set_account_type(account_type)¶
- Parameters:
account_type (
AccountsService.UserAccountType
) – aAccountsService.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 toAccountsService.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 (for example,en_US.utf8
), or the empty string to use the system default locale
Assigns a new locale for self, setting
AccountsService.User
:language
.Note this function is synchronous and ignores errors.
- set_languages(languages)¶
- Parameters:
languages ([
str
]) – an array of locale (for example,en_US.utf8
), or the empty string to use the system default locale
Assigns preferred languages for self, setting
AccountsService.User
:languages
, and overridingAccountsService.User
:language
with the first item in the list if there is one.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)¶
-
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_expiration_policy(min_days_between_changes, max_days_between_changes, days_to_warn, days_after_expiration_until_lock)¶
- Parameters:
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.
Set the password expiration policy for a user.
Note this function is synchronous and ignores errors.
- set_password_mode(password_mode)¶
- Parameters:
password_mode (
AccountsService.UserPasswordMode
) – aAccountsService.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 isAccountsService.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_expiration_policy(expiration_time)¶
- Parameters:
expiration_time (
int
) – location to write users expires timestamp
Set the user expiration policy for a user.
Note this function is synchronous and ignores errors.
Signal Details¶
- AccountsService.User.signals.changed(user)¶
- Signal Name:
changed
- Flags:
- 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:
- 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¶
-
The account type for this user.
- AccountsService.User.props.automatic_login¶
-
Automatic Login
- AccountsService.User.props.email¶
-
The email address for this user.
- AccountsService.User.props.home_directory¶
-
The home directory for this user.
- AccountsService.User.props.icon_file¶
-
The path to an icon for this user.
- AccountsService.User.props.is_loaded¶
-
Determines whether or not the user object is loaded and ready to read from.
- AccountsService.User.props.language¶
-
The user’s locale, in the format
language[_territory][.codeset][@modifier]
, wherelanguage
is an ISO 639 language code,territory
is an ISO 3166 country code, andcodeset
is a character set or encoding identifier likeISO-8859-1
orUTF-8
; as specified by setlocale(3)).The locale may be the empty string, which means the user is using the system default locale.
The property may be
None
if it wasn’t possible to load it from the daemon.
- AccountsService.User.props.local_account¶
-
Local Account
- AccountsService.User.props.location¶
-
The location of this user.
- AccountsService.User.props.locked¶
-
Locked
- AccountsService.User.props.login_frequency¶
-
login frequency
- AccountsService.User.props.login_history¶
- Name:
login-history
- Type:
- Default Value:
- Flags:
The login history for this user.
- AccountsService.User.props.login_time¶
-
The last login time for this user.
- AccountsService.User.props.nonexistent¶
-
Determines whether or not the user object represents a valid user account.
- AccountsService.User.props.password_hint¶
-
Hint to help this user remember his password
- AccountsService.User.props.password_mode¶
-
The password mode for this user.
- AccountsService.User.props.real_name¶
-
The real name to display for this user.
- AccountsService.User.props.shell¶
-
The shell for this user.
- AccountsService.User.props.system_account¶
-
System Account
- AccountsService.User.props.uid¶
-
The UID for this user.
- AccountsService.User.props.user_name¶
-
The login name for this user.