## OobsUsersConfig

OobsUsersConfig — Object that represents users configuration

## Synopsis

                        OobsUsersConfig;
    OobsObject*         oobs_users_config_get               (void);
    OobsList*           oobs_users_config_get_users         (OobsUsersConfig *config);
    OobsResult          oobs_users_config_add_user          (OobsUsersConfig *config,
                                                             OobsUser *user);
    OobsResult          oobs_users_config_delete_user       (OobsUsersConfig *config,
                                                             OobsUser *user);
    uid_t               oobs_users_config_get_minimum_users_uid
                                                            (OobsUsersConfig *config);
    void                oobs_users_config_set_minimum_users_uid
                                                            (OobsUsersConfig *config,
                                                             uid_t uid);
    uid_t               oobs_users_config_get_maximum_users_uid
                                                            (OobsUsersConfig *config);
    void                oobs_users_config_set_maximum_users_uid
                                                            (OobsUsersConfig *config,
                                                             uid_t uid);
    const gchar*        oobs_users_config_get_default_shell (OobsUsersConfig *config);
    void                oobs_users_config_set_default_shell (OobsUsersConfig *config,
                                                             const gchar *shell);
    const gchar*        oobs_users_config_get_default_home_dir
                                                            (OobsUsersConfig *config);
    void                oobs_users_config_set_default_home_dir
                                                            (OobsUsersConfig *config,
                                                             const gchar *home_dir);
    OobsGroup*          oobs_users_config_get_default_group (OobsUsersConfig *config);
    GList*              oobs_users_config_get_available_shells
                                                            (OobsUsersConfig *config);
    gboolean            oobs_users_config_get_encrypted_home_support
                                                            (OobsUsersConfig *config);
    GList*              oobs_users_config_get_available_locales
                                                            (OobsUsersConfig *config);
    OobsUser*           oobs_users_config_get_from_login    (OobsUsersConfig *config,
                                                             const gchar *login);
    OobsUser*           oobs_users_config_get_from_uid      (OobsUsersConfig *config,
                                                             uid_t uid);
    gboolean            oobs_users_config_is_login_used     (OobsUsersConfig *config,
                                                             const gchar *login);
    gboolean            oobs_users_config_is_uid_used       (OobsUsersConfig *config,
                                                             uid_t uid);
    uid_t               oobs_users_config_find_free_uid     (OobsUsersConfig *config,
                                                             uid_t uid_min,
                                                             uid_t uid_max);

## Object Hierarchy

      GObject
       +----OobsObject
             +----OobsUsersConfig

## Properties

      "default-group"            OobsGroup*            : Read
      "default-home"             gchar*                : Read / Write
      "default-shell"            gchar*                : Read / Write
      "encrypted-home"           gboolean              : Read
      "maximum-uid"              guint                 : Read / Write
      "minimum-uid"              guint                 : Read / Write

## Description

## Details

### OobsUsersConfig

    typedef struct _OobsUsersConfig OobsUsersConfig;

### oobs_users_config_get ()

    OobsObject*         oobs_users_config_get               (void);

Returns the OobsUsersConfig singleton, which represents the system users and their configuration.

Returns : | the singleton OobsUsersConfig object.

### oobs_users_config_get_users ()

    OobsList*           oobs_users_config_get_users         (OobsUsersConfig *config);

Returns an OobsList containing objects of type OobsUser.

`config` : | An OobsUsersConfig.
Returns : | an OobsList containing the system users.

### oobs_users_config_add_user ()

    OobsResult          oobs_users_config_add_user          (OobsUsersConfig *config,
                                                             OobsUser *user);

Add an user to the configuration, immediately committing changes to the system. On success, `user` will be appended to the users list.

`config` : | An OobsUsersConfig.
`user` : | An OobsUser.
Returns : | an OobsResult enum with the error code.

### oobs_users_config_delete_user ()

    OobsResult          oobs_users_config_delete_user       (OobsUsersConfig *config,
                                                             OobsUser *user);

Delete an user from the configuration, immediately committing changes to the system. On success, `user` will be removed from the users list.

`config` : | An OobsUsersConfig.
`user` : | An OobsUser.
Returns : | an OobsResult enum with the error code.

### oobs_users_config_get_minimum_users_uid ()

    uid_t               oobs_users_config_get_minimum_users_uid
                                                            (OobsUsersConfig *config);

Returns the default minimum UID for non-system users.

`config` : | An OobsUsersConfig.
Returns : | minimum UID for non-system users.

### oobs_users_config_set_minimum_users_uid ()

    void                oobs_users_config_set_minimum_users_uid
                                                            (OobsUsersConfig *config,
                                                             uid_t uid);

Sets the minimum UID for non-system users.

`config` : | An OobsUsersConfig.
`uid` : | new minimum UID for non-system users.

### oobs_users_config_get_maximum_users_uid ()

    uid_t               oobs_users_config_get_maximum_users_uid
                                                            (OobsUsersConfig *config);

Returns the default maximum UID for non-system users.

`config` : | An OobsUsersConfig.
Returns : | maximum UID for non-system users.

### oobs_users_config_set_maximum_users_uid ()

    void                oobs_users_config_set_maximum_users_uid
                                                            (OobsUsersConfig *config,
                                                             uid_t uid);

Sets the maximum UID for non-system users.

`config` : | An OobsUsersConfig.
`uid` : | a new maximum UID for non-system users.

### oobs_users_config_get_default_shell ()

    const gchar*        oobs_users_config_get_default_shell (OobsUsersConfig *config);

Returns the default shell that will be used for new users.

`config` : | An OobsUsersConfig
Returns : | A pointer to the default shell as a string. This string must not be freed, modified or stored.

### oobs_users_config_set_default_shell ()

    void                oobs_users_config_set_default_shell (OobsUsersConfig *config,
                                                             const gchar *shell);

Sets a new default shell for new users, replacing the old one.

`config` : | An OobsUsersConfig
`shell` : | new default shell for new users.

### oobs_users_config_get_default_home_dir ()

    const gchar*        oobs_users_config_get_default_home_dir
                                                            (OobsUsersConfig *config);

Returns the default home directory prefix for new users. when new users are created a directory with the user login name is created in that prefix.

`config` : | An OobsUsersConfig.
Returns : | A pointer to the default home directory prefix as a string. This string must not be freed, modified or stored.

### oobs_users_config_set_default_home_dir ()

    void                oobs_users_config_set_default_home_dir
                                                            (OobsUsersConfig *config,
                                                             const gchar *home_dir);

Sets a new home directory prefix used for newly created users, replacing the old one.

`config` : | An OobsUsersConfig.
`home_dir` : | new default home directory prefix.

### oobs_users_config_get_default_group ()

    OobsGroup*          oobs_users_config_get_default_group (OobsUsersConfig *config);

Returns an OobsGroup defining the default group used for new users.

`config` : | An OobsUsersConfig.
Returns : | An OobsGroup, you must not unref this object.

### oobs_users_config_get_available_shells ()

    GList*              oobs_users_config_get_available_shells
                                                            (OobsUsersConfig *config);

Returns a GList containing strings with paths to the available shells.

`config` : | An OobsUsersConfig
Returns : | a GList containing strings, you must not free neither this list or its elements.

### oobs_users_config_get_encrypted_home_support ()

    gboolean            oobs_users_config_get_encrypted_home_support
                                                            (OobsUsersConfig *config);

Returns whether encrypted home directories are supported by the platform (e.g. using eCryptfs).

`config` : | An OobsUsersConfig
Returns : | `TRUE` if encrypted home dirs are supported, `FALSE` otherwise.

### oobs_users_config_get_available_locales ()

    GList*              oobs_users_config_get_available_locales
                                                            (OobsUsersConfig *config);

`config` : |
Returns : |

### oobs_users_config_get_from_login ()

    OobsUser*           oobs_users_config_get_from_login    (OobsUsersConfig *config,
                                                             const gchar *login);

Gets the (first) user whose login is `login`. This is a convenience function to avoid walking manually over the users list.

`config` : | An OobsUsersConfig.
`login` : | the login name of the wanted user.
Returns : | an OobsUser corresponding to the passed login, or `NULL` if no such user exists. Don't forget to unref user when you're done.

### oobs_users_config_get_from_uid ()

    OobsUser*           oobs_users_config_get_from_uid      (OobsUsersConfig *config,
                                                             uid_t uid);

Gets the (first) user whose UID is `uid`. This is a convenience function to avoid walking manually over the users list.

`config` : | An OobsUsersConfig.
`uid` : | the UID of the wanted user.
Returns : | an OobsUser corresponding to the passed UID, or `NULL` if no such user exists. Don't forget to unref user when you're done.

### oobs_users_config_is_login_used ()

    gboolean            oobs_users_config_is_login_used     (OobsUsersConfig *config,
                                                             const gchar *login);

Check whether `login` is already used by an existing user or not. This is a convenience function to avoid walking manually over the users list.

`config` : | An OobsUsersConfig.
`login` : | the login name to check.
Returns : | `TRUE` if an user named `login` already exists, `FALSE` otherwise.

### oobs_users_config_is_uid_used ()

    gboolean            oobs_users_config_is_uid_used       (OobsUsersConfig *config,
                                                             uid_t uid);

Check whether `uid` is already used by an existing user or not. This is a convenience function to avoid walking manually over the users list.

`config` : | An OobsUsersConfig.
`uid` : | the UID to check.
Returns : | `TRUE` if an user with such an UID already exists, `FALSE` otherwise.

### oobs_users_config_find_free_uid ()

    uid_t               oobs_users_config_find_free_uid     (OobsUsersConfig *config,
                                                             uid_t uid_min,
                                                             uid_t uid_max);

Finds an UID that is not used by any user in the list. The returned UID is the highest used UID in the range plus one if `uid_max` is not used. Else, the first free UID in the range is returned.

If both `uid_min` and `uid_max` are equal to 0, the default range is used.

`config` : | An OobsUsersConfig.
`uid_min` : | the minimum wanted UID.
`uid_max` : | the maximum wanted UID.
Returns : | a free UID in the requested range, or `uid_max` to indicate wrong use or failure to find a free UID.

## Property Details

### The `"default-group"` property

      "default-group"            OobsGroup*            : Read

Default group for new users.

### The `"default-home"` property

      "default-home"             gchar*                : Read / Write

Default home directory for new users.

Default value: NULL

### The `"default-shell"` property

      "default-shell"            gchar*                : Read / Write

Default shell for new users.

Default value: NULL

### The `"encrypted-home"` property

      "encrypted-home"           gboolean              : Read

Whether encrypted home dirs are supported.

Default value: FALSE

### The `"maximum-uid"` property

      "maximum-uid"              guint                 : Read / Write

Maximum UID for non-system users.

Allowed values: <= G_MAXINT

Default value: 2147483647

### The `"minimum-uid"` property

      "minimum-uid"              guint                 : Read / Write

Minimum UID for non-system users.

Allowed values: <= G_MAXINT

Default value: 2147483647

## See Also

OobsUser