ActUser

ActUser — information about a user account

Functions

gint act_user_collate ()
ActUserAccountType act_user_get_account_type ()
gboolean act_user_get_automatic_login ()
const char * act_user_get_email ()
const char * act_user_get_home_dir ()
const char * act_user_get_icon_file ()
const char * act_user_get_language ()
const char * act_user_get_location ()
gboolean act_user_get_locked ()
int act_user_get_login_frequency ()
const GVariant * act_user_get_login_history ()
gint64 act_user_get_login_time ()
guint act_user_get_num_sessions ()
guint act_user_get_num_sessions_anywhere ()
const char * act_user_get_object_path ()
void act_user_get_password_expiration_policy ()
const char * act_user_get_password_hint ()
ActUserPasswordMode act_user_get_password_mode ()
const char * act_user_get_primary_session_id ()
const char * act_user_get_real_name ()
gboolean act_user_get_saved ()
const char * act_user_get_session ()
const char * act_user_get_session_type ()
const char * act_user_get_shell ()
uid_t act_user_get_uid ()
const char * act_user_get_user_name ()
const char * act_user_get_x_session ()
gboolean act_user_is_loaded ()
gboolean act_user_is_local_account ()
gboolean act_user_is_logged_in ()
gboolean act_user_is_logged_in_anywhere ()
gboolean act_user_is_nonexistent ()
gboolean act_user_is_system_account ()
void act_user_set_account_type ()
void act_user_set_automatic_login ()
void act_user_set_email ()
void act_user_set_icon_file ()
void act_user_set_language ()
void act_user_set_languages ()
void act_user_set_location ()
void act_user_set_locked ()
void act_user_set_password ()
void act_user_set_password_hint ()
void act_user_set_password_mode ()
void act_user_set_real_name ()
void act_user_set_session ()
void act_user_set_session_type ()
void act_user_set_user_name ()
void act_user_set_x_session ()

Properties

int account-type Read
gboolean automatic-login Read
char * email Read
char * home-directory Read
char * icon-file Read
gboolean is-loaded Read
char * language Read
gboolean local-account Read
char * location Read
gboolean locked Read
int login-frequency Read
GVariant * login-history Read
gint64 login-time Read
gboolean nonexistent Read
char * password-hint Read
int password-mode Read
char * real-name Read
char * shell Read
gboolean system-account Read
int uid Read
char * user-name Read
char * x-session Read

Signals

void changed Run Last
void sessions-changed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── ActUser

Description

An ActUser object represents a user account on the system.

Functions

act_user_collate ()

gint
act_user_collate (ActUser *user1,
                  ActUser *user2);

Organize the user by login frequency and names.

Parameters

user1

a user

 

user2

a user

 

Returns

negative if user1 is before user2 , zero if equal or positive if user1 is after user2


act_user_get_account_type ()

ActUserAccountType
act_user_get_account_type (ActUser *user);

Retrieves the account type of user .

Parameters

user

the user object to examine.

 

Returns

a ActUserAccountType


act_user_get_automatic_login ()

gboolean
act_user_get_automatic_login (ActUser *user);

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

Parameters

user

a ActUser

 

Returns

TRUE or FALSE


act_user_get_email ()

const char *
act_user_get_email (ActUser *user);

Retrieves the email address set by user .

Parameters

user

the user object to examine.

 

Returns

a pointer to an array of characters which must not be modified or freed, or NULL.

[transfer none]


act_user_get_home_dir ()

const char *
act_user_get_home_dir (ActUser *user);

Retrieves the home directory for user .

Parameters

user

the user object to examine.

 

Returns

a pointer to an array of characters which must not be modified or freed, or NULL.

[transfer none]


act_user_get_icon_file ()

const char *
act_user_get_icon_file (ActUser *user);

Returns the path to the account icon belonging to user .

Parameters

user

a ActUser

 

Returns

a path to an icon.

[transfer none]


act_user_get_language ()

const char *
act_user_get_language (ActUser *user);

Returns the value of “language”.

Parameters

user

a ActUser

 

Returns

the user’s language, or the empty string if they are using the system default language, or NULL if there is no connection to the daemon.

[transfer none][nullable]


act_user_get_location ()

const char *
act_user_get_location (ActUser *user);

Retrieves the location set by user .

Parameters

user

the user object to examine.

 

Returns

a pointer to an array of characters which must not be modified or freed, or NULL.

[transfer none]


act_user_get_locked ()

gboolean
act_user_get_locked (ActUser *user);

Returns whether or not the ActUser account is locked.

Parameters

user

a ActUser

 

Returns

TRUE or FALSE


act_user_get_login_frequency ()

int
act_user_get_login_frequency (ActUser *user);

Returns the number of times user has logged in.

Parameters

user

a ActUser

 

Returns

the login frequency


act_user_get_login_history ()

const GVariant *
act_user_get_login_history (ActUser *user);

Returns the login history for user .

Parameters

user

a ActUser

 

Returns

a pointer to GVariant of type "a(xxa{sv})" which must not be modified or freed, or NULL.

[transfer none]


act_user_get_login_time ()

gint64
act_user_get_login_time (ActUser *user);

Returns the last login time for user .

Parameters

user

a ActUser

 

Returns

the login time


act_user_get_num_sessions ()

guint
act_user_get_num_sessions (ActUser *user);

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

Parameters

user

a user

 

Returns

the number of sessions


act_user_get_num_sessions_anywhere ()

guint
act_user_get_num_sessions_anywhere (ActUser *user);

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

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

Parameters

user

a user

 

Returns

the number of sessions


act_user_get_object_path ()

const char *
act_user_get_object_path (ActUser *user);

Returns the user accounts service object path of user , or NULL if user doesn't have an object path associated with it.

Parameters

user

a ActUser

 

Returns

the object path of the user.

[transfer none]


act_user_get_password_expiration_policy ()

void
act_user_get_password_expiration_policy
                               (ActUser *user,
                                gint64 *expiration_time,
                                gint64 *last_change_time,
                                gint64 *min_days_between_changes,
                                gint64 *max_days_between_changes,
                                gint64 *days_to_warn,
                                gint64 *days_after_expiration_until_lock);

Get the password expiration policy for a user.

Note this function is synchronous and ignores errors.

Parameters

user

the user object to query.

 

expiration_time

location to write time users password expires.

[out][optional]

last_change_time

location to write time users password was last changed.

[out][optional]

min_days_between_changes

location to write minimum number of days needed between password changes.

[out][optional]

max_days_between_changes

location to write maximum number of days password can stay unchanged.

[out][optional]

days_to_warn

location to write number of days to warn user password is about to expire.

[out][optional]

days_after_expiration_until_lock

location to write number of days account will be locked after password expires.

[out][optional]

act_user_get_password_hint ()

const char *
act_user_get_password_hint (ActUser *user);

Retrieves the password hint set by user .

Parameters

user

the user object to examine.

 

Returns

a pointer to an array of characters which must not be modified or freed, or NULL.

[transfer none]


act_user_get_password_mode ()

ActUserPasswordMode
act_user_get_password_mode (ActUser *user);

Retrieves the password mode of user .

Parameters

user

the user object to examine.

 

act_user_get_primary_session_id ()

const char *
act_user_get_primary_session_id (ActUser *user);

Returns the id of the primary session of user , or NULL if user 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.

Parameters

user

a ActUser

 

Returns

the id of the primary session of the user.

[transfer none]


act_user_get_real_name ()

const char *
act_user_get_real_name (ActUser *user);

Retrieves the display name of user .

Parameters

user

the user object to examine.

 

Returns

a pointer to an array of characters which must not be modified or freed, or NULL.

[transfer none]


act_user_get_saved ()

gboolean
act_user_get_saved (ActUser *user);

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

Parameters

user

a ActUser

 

Returns

TRUE or FALSE


act_user_get_session ()

const char *
act_user_get_session (ActUser *user);

Returns the path to the configured session for user .

Parameters

user

a ActUser

 

Returns

a path to an icon.

[transfer none]


act_user_get_session_type ()

const char *
act_user_get_session_type (ActUser *user);

Returns the type of the configured session for user .

Parameters

user

a ActUser

 

Returns

a path to an icon.

[transfer none]


act_user_get_shell ()

const char *
act_user_get_shell (ActUser *user);

Retrieves the shell assigned to user .

Parameters

user

the user object to examine.

 

Returns

a pointer to an array of characters which must not be modified or freed, or NULL.

[transfer none]


act_user_get_uid ()

uid_t
act_user_get_uid (ActUser *user);

Retrieves the ID of user .

Parameters

user

the user object to examine.

 

Returns

a pointer to an array of characters which must not be modified or freed, or NULL.


act_user_get_user_name ()

const char *
act_user_get_user_name (ActUser *user);

Retrieves the login name of user .

Parameters

user

the user object to examine.

 

Returns

a pointer to an array of characters which must not be modified or freed, or NULL.

[transfer none]


act_user_get_x_session ()

const char *
act_user_get_x_session (ActUser *user);

Returns the path to the configured X session for user .

Parameters

user

a ActUser

 

Returns

a path to an icon.

[transfer none]


act_user_is_loaded ()

gboolean
act_user_is_loaded (ActUser *user);

Determines whether or not the user object is loaded and ready to read from. “is-loaded” property must be TRUE before calling act_user_manager_list_users()

Parameters

user

a ActUser

 

Returns

TRUE or FALSE


act_user_is_local_account ()

gboolean
act_user_is_local_account (ActUser *user);

Retrieves whether the user is a local account or not.

Parameters

user

the user object to examine.

 

Returns

TRUE if the user is local


act_user_is_logged_in ()

gboolean
act_user_is_logged_in (ActUser *user);

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

Parameters

user

a ActUser

 

Returns

TRUE or FALSE


act_user_is_logged_in_anywhere ()

gboolean
act_user_is_logged_in_anywhere (ActUser *user);

Returns whether or not ActUser is currently logged in in any way whatsoever. See also act_user_is_logged_in().

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

Parameters

user

a ActUser

 

Returns

TRUE or FALSE


act_user_is_nonexistent ()

gboolean
act_user_is_nonexistent (ActUser *user);

Retrieves whether the user is nonexistent or not.

Parameters

user

the user object to examine.

 

Returns

TRUE if the user is nonexistent


act_user_is_system_account ()

gboolean
act_user_is_system_account (ActUser *user);

Returns whether or not ActUser represents a 'system account' like 'root' or 'nobody'.

Parameters

user

a ActUser

 

Returns

TRUE or FALSE


act_user_set_account_type ()

void
act_user_set_account_type (ActUser *user,
                           ActUserAccountType account_type);

Changes the account type of user .

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

account_type

a ActUserAccountType

 

act_user_set_automatic_login ()

void
act_user_set_automatic_login (ActUser *user,
                              gboolean enabled);

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 act_user_set_automatic_login() override previous calls.

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter

 

enabled

whether or not to autologin for user.

 

act_user_set_email ()

void
act_user_set_email (ActUser *user,
                    const char *email);

Assigns a new email to user .

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

email

an email address

 

act_user_set_icon_file ()

void
act_user_set_icon_file (ActUser *user,
                        const char *icon_file);

Assigns a new icon for user .

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

icon_file

path to an icon

 

act_user_set_language ()

void
act_user_set_language (ActUser *user,
                       const char *language);

Assigns a new locale for user , setting “language”.

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

language

a locale (for example, en_US.utf8), or the empty string to use the system default locale.

[not nullable]

act_user_set_languages ()

void
act_user_set_languages (ActUser *user,
                        const char * const *languages);

Assigns preferred languages for user , setting “languages”, and overriding “language” with the first item in the list if there is one.

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

languages

an array of locale (for example, en_US.utf8), or the empty string to use the system default locale.

[array zero-terminated=1][not nullable]

act_user_set_location ()

void
act_user_set_location (ActUser *user,
                       const char *location);

Assigns a new location for user .

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

location

a location

 

act_user_set_locked ()

void
act_user_set_locked (ActUser *user,
                     gboolean locked);

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

locked

whether or not the account is locked

 

act_user_set_password ()

void
act_user_set_password (ActUser *user,
                       const gchar *password,
                       const gchar *hint);

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

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

password

a password

 

hint

a hint to help user recall password

 

act_user_set_password_hint ()

void
act_user_set_password_hint (ActUser *user,
                            const gchar *hint);

act_user_set_password_mode ()

void
act_user_set_password_mode (ActUser *user,
                            ActUserPasswordMode password_mode);

Changes the password of user . If password_mode is ACT_USER_PASSWORD_MODE_SET_AT_LOGIN then the user will be asked for a new password at the next login. If password_mode is ACT_USER_PASSWORD_MODE_NONE then the user will not require a password to log in.

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

password_mode

a ActUserPasswordMode

 

act_user_set_real_name ()

void
act_user_set_real_name (ActUser *user,
                        const char *real_name);

Assigns a new name for user .

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

real_name

a new name

 

act_user_set_session ()

void
act_user_set_session (ActUser *user,
                      const char *session);

Assigns a new session for user .

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

session

a session (e.g. gnome)

 

act_user_set_session_type ()

void
act_user_set_session_type (ActUser *user,
                           const char *session_type);

Assigns a type to the session for user .

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

session_type

a type of session (e.g. "wayland" or "x11")

 

act_user_set_user_name ()

void
act_user_set_user_name (ActUser *user,
                        const char *user_name);

Assigns a new username for user .

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

user_name

a new user name

 

act_user_set_x_session ()

void
act_user_set_x_session (ActUser *user,
                        const char *x_session);

Assigns a new x session for user .

Note this function is synchronous and ignores errors.

Parameters

user

the user object to alter.

 

x_session

an x session (e.g. gnome)

 

Types and Values

ActUser

typedef struct _ActUser ActUser;

Represents a user account on the system.


enum ActUserAccountType

Type of user account

Members

ACT_USER_ACCOUNT_TYPE_STANDARD

Normal non-administrative user

 

ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR

Administrative user

 

enum ActUserPasswordMode

Mode for setting the user's password.

Members

ACT_USER_PASSWORD_MODE_REGULAR

Password set normally

 

ACT_USER_PASSWORD_MODE_SET_AT_LOGIN

Password will be chosen at next login

 

ACT_USER_PASSWORD_MODE_NONE

No password set

 

Property Details

The “account-type” property

  “account-type”             int

The account type for this user.

Owner: ActUser

Flags: Read

Allowed values: [0,1]

Default value: 0


The “automatic-login” property

  “automatic-login”          gboolean

Automatic Login.

Owner: ActUser

Flags: Read

Default value: FALSE


The “email” property

  “email”                    char *

The email address for this user.

Owner: ActUser

Flags: Read

Default value: NULL


The “home-directory” property

  “home-directory”           char *

The home directory for this user.

Owner: ActUser

Flags: Read

Default value: NULL


The “icon-file” property

  “icon-file”                char *

The path to an icon for this user.

Owner: ActUser

Flags: Read

Default value: NULL


The “is-loaded” property

  “is-loaded”                gboolean

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

Owner: ActUser

Flags: Read

Default value: FALSE


The “language” property

  “language”                 char *

The user’s locale, in the format language[_territory][.codeset][@modifier], where language is an ISO 639 language code, territory is an ISO 3166 country code, and codeset is a character set or encoding identifier like ISO-8859-1 or UTF-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 NULL if it wasn’t possible to load it from the daemon.

[nullable]

Owner: ActUser

Flags: Read

Default value: NULL


The “local-account” property

  “local-account”            gboolean

Local Account.

Owner: ActUser

Flags: Read

Default value: FALSE


The “location” property

  “location”                 char *

The location of this user.

Owner: ActUser

Flags: Read

Default value: NULL


The “locked” property

  “locked”                   gboolean

Locked.

Owner: ActUser

Flags: Read

Default value: FALSE


The “login-frequency” property

  “login-frequency”          int

login frequency.

Owner: ActUser

Flags: Read

Allowed values: >= 0

Default value: 0


The “login-history” property

  “login-history”            GVariant *

The login history for this user.

Owner: ActUser

Flags: Read

Allowed values: GVariant<a(xxa{sv})>

Default value: NULL


The “login-time” property

  “login-time”               gint64

The last login time for this user.

Owner: ActUser

Flags: Read

Allowed values: >= 0

Default value: 0


The “nonexistent” property

  “nonexistent”              gboolean

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

Owner: ActUser

Flags: Read

Default value: FALSE


The “password-hint” property

  “password-hint”            char *

Hint to help this user remember his password.

Owner: ActUser

Flags: Read

Default value: NULL


The “password-mode” property

  “password-mode”            int

The password mode for this user.

Owner: ActUser

Flags: Read

Allowed values: [0,2]

Default value: 0


The “real-name” property

  “real-name”                char *

The real name to display for this user.

Owner: ActUser

Flags: Read

Default value: NULL


The “shell” property

  “shell”                    char *

The shell for this user.

Owner: ActUser

Flags: Read

Default value: NULL


The “system-account” property

  “system-account”           gboolean

System Account.

Owner: ActUser

Flags: Read

Default value: FALSE


The “uid” property

  “uid”                      int

The UID for this user.

Owner: ActUser

Flags: Read

Allowed values: >= 0

Default value: 0


The “user-name” property

  “user-name”                char *

The login name for this user.

Owner: ActUser

Flags: Read

Default value: NULL


The “x-session” property

  “x-session”                char *

User's X session.

Owner: ActUser

Flags: Read

Default value: NULL

Signal Details

The “changed” signal

void
user_function (ActUser *actuser,
               gpointer user_data)

Emitted when the user accounts changes in some way.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “sessions-changed” signal

void
user_function (ActUser *actuser,
               gpointer user_data)

Emitted when the list of sessions for this user changes.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last