ActUser: libaccountsservice Reference Manual

## 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 ()
const char * | act_user_get_object_path ()
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 ()
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_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_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_user_name ()
void | act_user_set_x_session ()

## Properties

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

## Signals

void | changed | Run Last
void | sessions-changed | Run Last

## Types and Values

| ActUser
enum | ActUserAccountType
enum | ActUserPasswordMode

## 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 path to the configured locale of `user` .

#### Parameters

user | a ActUser |

#### Returns

a path to an icon.

[transfer none]

### 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.

[transfer none]

### 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_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_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. |

#### Returns

a ActUserPasswordMode

### 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_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`.

[transfer none]

### 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.

[transfer none]

### 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_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` .

Note this function is synchronous and ignores errors.

#### Parameters

user | the user object to alter. |
language | a locale (e.g. en_US.utf8) |

### 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_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”             gint

The account type for this user.

Flags: Read

Allowed values: [0,1]

Default value: 0

### The `“automatic-login”` property

      “automatic-login”          gboolean

Automatic Login.

Flags: Read

Default value: FALSE

### The `“email”` property

      “email”                    gchar *

The email address for this user.

Flags: Read

Default value: NULL

### The `“home-directory”` property

      “home-directory”           gchar *

The home directory for this user.

Flags: Read

Default value: NULL

### The `“icon-file”` property

      “icon-file”                gchar *

The path to an icon for this user.

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.

Flags: Read

Default value: FALSE

### The `“language”` property

      “language”                 gchar *

User's locale.

Flags: Read

Default value: NULL

### The `“local-account”` property

      “local-account”            gboolean

Local Account.

Flags: Read

Default value: FALSE

### The `“location”` property

      “location”                 gchar *

The location of this user.

Flags: Read

Default value: NULL

### The `“locked”` property

      “locked”                   gboolean

Locked.

Flags: Read

Default value: FALSE

### The `“login-frequency”` property

      “login-frequency”          gint

login frequency.

Flags: Read

Allowed values: >= 0

Default value: 0

### The `“login-history”` property

      “login-history”            GVariant *

The login history for this user.

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.

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.

Flags: Read

Default value: FALSE

### The `“password-hint”` property

      “password-hint”            gchar *

Hint to help this user remember his password.

Flags: Read

Default value: NULL

### The `“password-mode”` property

      “password-mode”            gint

The password mode for this user.

Flags: Read

Allowed values: [0,2]

Default value: 0

### The `“real-name”` property

      “real-name”                gchar *

The real name to display for this user.

Flags: Read

Default value: NULL

### The `“shell”` property

      “shell”                    gchar *

The shell for this user.

Flags: Read

Default value: NULL

### The `“system-account”` property

      “system-account”           gboolean

System Account.

Flags: Read

Default value: FALSE

### The `“uid”` property

      “uid”                      gint

The UID for this user.

Flags: Read

Allowed values: >= 0

Default value: 0

### The `“user-name”` property

      “user-name”                gchar *

The login name for this user.

Flags: Read

Default value: NULL

### The `“x-session”` property

      “x-session”                gchar *

User's X session.

Flags: Read

Default value: NULL

## Signal Details

### The `“changed”` signal

    void
    user_function (ActUser *arg0,
                   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 *arg0,
                   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