ActUserManager

## ActUserManager ActUserManager — manages ActUser objects |

## Synopsis

    #define             ACT_USER_MANAGER_ERROR
    typedef             ActUserManager;
    typedef             ActUserManagerClass;
    enum                ActUserManagerError;
    gboolean            act_user_manager_activate_user_session
                                                            (ActUserManager *manager,
                                                             ActUser *user);
    ActUser *           act_user_manager_cache_user         (ActUserManager *manager,
                                                             const char *username,
                                                             GError **error);
    void                act_user_manager_cache_user_async   (ActUserManager *manager,
                                                             const gchar *username,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    ActUser *           act_user_manager_cache_user_finish  (ActUserManager *manager,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            act_user_manager_can_switch         (ActUserManager *manager);
    ActUser *           act_user_manager_create_user        (ActUserManager *manager,
                                                             const char *username,
                                                             const char *fullname,
                                                             ActUserAccountType accounttype,
                                                             GError **error);
    void                act_user_manager_create_user_async  (ActUserManager *manager,
                                                             const gchar *username,
                                                             const gchar *fullname,
                                                             ActUserAccountType accounttype,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    ActUser *           act_user_manager_create_user_finish (ActUserManager *manager,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            act_user_manager_delete_user        (ActUserManager *manager,
                                                             ActUser *user,
                                                             gboolean remove_files,
                                                             GError **error);
    void                act_user_manager_delete_user_async  (ActUserManager *manager,
                                                             ActUser *user,
                                                             gboolean remove_files,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            act_user_manager_delete_user_finish (ActUserManager *manager,
                                                             GAsyncResult *result,
                                                             GError **error);
    GQuark              act_user_manager_error_quark        (void);
    ActUserManager *    act_user_manager_get_default        (void);
    ActUser *           act_user_manager_get_user           (ActUserManager *manager,
                                                             const char *username);
    ActUser *           act_user_manager_get_user_by_id     (ActUserManager *manager,
                                                             uid_t id);
    gboolean            act_user_manager_goto_login_session (ActUserManager *manager);
    GSList *            act_user_manager_list_users         (ActUserManager *manager);
    gboolean            act_user_manager_no_service         (ActUserManager *manager);
    gboolean            act_user_manager_uncache_user       (ActUserManager *manager,
                                                             const char *username,
                                                             GError **error);
    void                (*user_added)                       (ActUserManager *user_manager,
                                                             ActUser *user);
    void                (*user_changed)                     (ActUserManager *user_manager,
                                                             ActUser *user);
    void                (*user_is_logged_in_changed)        (ActUserManager *user_manager,
                                                             ActUser *user);
    void                (*user_removed)                     (ActUserManager *user_manager,
                                                             ActUser *user);

## Object Hierarchy

      GObject
       +----ActUserManager

## Properties

      "exclude-usernames-list"   gpointer              : Read / Write
      "has-multiple-users"       gboolean              : Read
      "include-usernames-list"   gpointer              : Read / Write
      "is-loaded"                gboolean              : Read

## Signals

      "user-added"                                     : Run Last
      "user-changed"                                   : Run Last
      "user-is-logged-in-changed"                      : Run Last
      "user-removed"                                   : Run Last

## Description

ActUserManager is a manager object that gives access to user creation, deletion, enumeration, etc.

There is typically a singleton ActUserManager object, which can be obtained by `act_user_manager_get_default()`.

## Details

### ACT_USER_MANAGER_ERROR

    #define ACT_USER_MANAGER_ERROR act_user_manager_error_quark ()

### ActUserManager

    typedef struct ActUserManager ActUserManager;

### ActUserManagerClass

    typedef struct ActUserManagerClass ActUserManagerClass;

### enum ActUserManagerError

    typedef enum {
            ACT_USER_MANAGER_ERROR_FAILED,
            ACT_USER_MANAGER_ERROR_USER_EXISTS,
            ACT_USER_MANAGER_ERROR_USER_DOES_NOT_EXIST,
            ACT_USER_MANAGER_ERROR_PERMISSION_DENIED,
            ACT_USER_MANAGER_ERROR_NOT_SUPPORTED
    } ActUserManagerError;

### act_user_manager_activate_user_session ()

    gboolean            act_user_manager_activate_user_session
                                                            (ActUserManager *manager,
                                                             ActUser *user);

### act_user_manager_cache_user ()

    ActUser *           act_user_manager_cache_user         (ActUserManager *manager,
                                                             const char *username,
                                                             GError **error);

Caches a user account so it shows up via `act_user_manager_list_users()`.

`manager` : | a ActUserManager
`username` : | a user name
`error` : | a GError
Returns : | user object. [transfer full]

### act_user_manager_cache_user_async ()

    void                act_user_manager_cache_user_async   (ActUserManager *manager,
                                                             const gchar *username,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously caches a user account so it shows up via `act_user_manager_list_users()`.

For more details, see `act_user_manager_cache_user()`, which is the synchronous version of this call.

`manager` : | a ActUserManager
`username` : | a unix user name
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is satisfied `user_data` (closure): the data to pass to `callback`. [scope async]

Since 0.6.27

### act_user_manager_cache_user_finish ()

    ActUser *           act_user_manager_cache_user_finish  (ActUserManager *manager,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an asynchronous user caching.

See `act_user_manager_cache_user_async()`.

`manager` : | a ActUserManager
`result` : | a GAsyncResult
`error` : | a GError
Returns : | user object. [transfer full]

Since 0.6.27

### act_user_manager_can_switch ()

    gboolean            act_user_manager_can_switch         (ActUserManager *manager);

### act_user_manager_create_user ()

    ActUser *           act_user_manager_create_user        (ActUserManager *manager,
                                                             const char *username,
                                                             const char *fullname,
                                                             ActUserAccountType accounttype,
                                                             GError **error);

Creates a user account on the system.

`manager` : | a ActUserManager
`username` : | a unix user name
`fullname` : | a unix GECOS value
`accounttype` : | a ActUserAccountType
`error` : | a GError
Returns : | user object. [transfer full]

### act_user_manager_create_user_async ()

    void                act_user_manager_create_user_async  (ActUserManager *manager,
                                                             const gchar *username,
                                                             const gchar *fullname,
                                                             ActUserAccountType accounttype,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously creates a user account on the system.

For more details, see `act_user_manager_create_user()`, which is the synchronous version of this call.

`manager` : | a ActUserManager
`username` : | a unix user name
`fullname` : | a unix GECOS value
`accounttype` : | a ActUserAccountType
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is satisfied `user_data` (closure): the data to pass to `callback`. [scope async]

Since 0.6.27

### act_user_manager_create_user_finish ()

    ActUser *           act_user_manager_create_user_finish (ActUserManager *manager,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an asynchronous user creation.

See `act_user_manager_create_user_async()`.

`manager` : | a ActUserManager
`result` : | a GAsyncResult
`error` : | a GError
Returns : | user object. [transfer full]

Since 0.6.27

### act_user_manager_delete_user ()

    gboolean            act_user_manager_delete_user        (ActUserManager *manager,
                                                             ActUser *user,
                                                             gboolean remove_files,
                                                             GError **error);

Deletes a user account on the system.

`manager` : | a ActUserManager
`user` : | an ActUser object
`remove_files` : | `TRUE` to delete the users home directory
`error` : | a GError
Returns : | `TRUE` if the user account was successfully deleted

### act_user_manager_delete_user_async ()

    void                act_user_manager_delete_user_async  (ActUserManager *manager,
                                                             ActUser *user,
                                                             gboolean remove_files,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously deletes a user account from the system.

For more details, see `act_user_manager_delete_user()`, which is the synchronous version of this call.

`manager` : | a ActUserManager
`user` : | a ActUser object
`remove_files` : | `TRUE` to delete the users home directory
`cancellable` : | optional GCancellable object, `NULL` to ignore. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is satisfied `user_data` (closure): the data to pass to `callback`. [scope async]

Since 0.6.27

### act_user_manager_delete_user_finish ()

    gboolean            act_user_manager_delete_user_finish (ActUserManager *manager,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an asynchronous user account deletion.

See `act_user_manager_delete_user_async()`.

`manager` : | a ActUserManager
`result` : | a GAsyncResult
`error` : | a GError
Returns : | `TRUE` if the user account was successfully deleted

Since 0.6.27

### act_user_manager_error_quark ()

    GQuark              act_user_manager_error_quark        (void);

### act_user_manager_get_default ()

    ActUserManager *    act_user_manager_get_default        (void);

Returns the user manager singleton instance. Calling this function will automatically being loading the user list if it isn't loaded already. The "is-loaded" property will be set to `TRUE` when the users are finished loading and then `act_user_manager_list_users()` can be called.

Returns : | user manager object. [transfer none]

### act_user_manager_get_user ()

    ActUser *           act_user_manager_get_user           (ActUserManager *manager,
                                                             const char *username);

Retrieves a pointer to the ActUser object for the login `username` from `manager`. Trying to use this object before its "is-loaded" property is `TRUE` will result in undefined behavior.

`manager` : | the manager to query.
`username` : | the login name of the user to get.
Returns : | ActUser object. [transfer none]

### act_user_manager_get_user_by_id ()

    ActUser *           act_user_manager_get_user_by_id     (ActUserManager *manager,
                                                             uid_t id);

Retrieves a pointer to the ActUser object for the user with the given uid from `manager`. Trying to use this object before its "is-loaded" property is `TRUE` will result in undefined behavior.

`manager` : | the manager to query.
`id` : | the uid of the user to get.
Returns : | ActUser object. [transfer none]

### act_user_manager_goto_login_session ()

    gboolean            act_user_manager_goto_login_session (ActUserManager *manager);

### act_user_manager_list_users ()

    GSList *            act_user_manager_list_users         (ActUserManager *manager);

Get a list of system user accounts

`manager` : | a ActUserManager
Returns : | List of ActUser objects. [element-type ActUser][transfer container]

### act_user_manager_no_service ()

    gboolean            act_user_manager_no_service         (ActUserManager *manager);

`manager` : | a ActUserManager
Returns : | whether or not accounts service is running

### act_user_manager_uncache_user ()

    gboolean            act_user_manager_uncache_user       (ActUserManager *manager,
                                                             const char *username,
                                                             GError **error);

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.

`manager` : | a ActUserManager
`username` : | a user name
`error` : | a GError
Returns : | `TRUE` if successful, otherwise `FALSE`

### user_added ()

    void                (*user_added)                       (ActUserManager *user_manager,
                                                             ActUser *user);

### user_changed ()

    void                (*user_changed)                     (ActUserManager *user_manager,
                                                             ActUser *user);

### user_is_logged_in_changed ()

    void                (*user_is_logged_in_changed)        (ActUserManager *user_manager,
                                                             ActUser *user);

### user_removed ()

    void                (*user_removed)                     (ActUserManager *user_manager,
                                                             ActUser *user);

## Property Details

### The `"exclude-usernames-list"` property

      "exclude-usernames-list"   gpointer              : Read / Write

### The `"has-multiple-users"` property

      "has-multiple-users"       gboolean              : Read

Default value: FALSE

### The `"include-usernames-list"` property

      "include-usernames-list"   gpointer              : Read / Write

### The `"is-loaded"` property

      "is-loaded"                gboolean              : Read

Default value: FALSE

## Signal Details

### The `"user-added"` signal

    void                user_function                      (ActUserManager *actusermanager,
                                                            ActUser        *arg1,
                                                            gpointer        user_data)           : Run Last

### The `"user-changed"` signal

    void                user_function                      (ActUserManager *actusermanager,
                                                            ActUser        *arg1,
                                                            gpointer        user_data)           : Run Last

### The `"user-is-logged-in-changed"` signal

    void                user_function                      (ActUserManager *actusermanager,
                                                            ActUser        *arg1,
                                                            gpointer        user_data)           : Run Last

### The `"user-removed"` signal

    void                user_function                      (ActUserManager *actusermanager,
                                                            ActUser        *arg1,
                                                            gpointer        user_data)           : Run Last