## OobsUsersConfig

OobsUsersConfig — Object that represents users configuration

## Functions

OobsObject * | oobs_users_config_get ()
OobsList * | oobs_users_config_get_users ()
OobsResult | oobs_users_config_add_user ()
OobsResult | oobs_users_config_delete_user ()
uid_t | oobs_users_config_get_minimum_users_uid ()
void | oobs_users_config_set_minimum_users_uid ()
uid_t | oobs_users_config_get_maximum_users_uid ()
void | oobs_users_config_set_maximum_users_uid ()
const gchar * | oobs_users_config_get_default_shell ()
void | oobs_users_config_set_default_shell ()
const gchar * | oobs_users_config_get_default_home_dir ()
void | oobs_users_config_set_default_home_dir ()
OobsGroup * | oobs_users_config_get_default_group ()
GList * | oobs_users_config_get_available_shells ()
gboolean | oobs_users_config_get_encrypted_home_support ()
GList * | oobs_users_config_get_available_locales ()
OobsUser * | oobs_users_config_get_from_login ()
OobsUser * | oobs_users_config_get_from_uid ()
gboolean | oobs_users_config_is_login_used ()
gboolean | oobs_users_config_is_uid_used ()
uid_t | oobs_users_config_find_free_uid ()

## Properties

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

## Object Hierarchy

        GObject
        ╰── OobsObject
            ╰── OobsUsersConfig

## Description

## Functions

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

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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

#### Parameters

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);

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

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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 *

Default group for new users.

Owner: OobsUsersConfig

Flags: Read

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

      “default-home”             gchar *

Default home directory for new users.

Owner: OobsUsersConfig

Flags: Read / Write

Default value: NULL

### The `“default-shell”` property

      “default-shell”            gchar *

Default shell for new users.

Owner: OobsUsersConfig

Flags: Read / Write

Default value: NULL

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

      “encrypted-home”           gboolean

Whether encrypted home dirs are supported.

Owner: OobsUsersConfig

Flags: Read

Default value: FALSE

### The `“maximum-uid”` property

      “maximum-uid”              guint

Maximum UID for non-system users.

Owner: OobsUsersConfig

Flags: Read / Write

Allowed values: <= G_MAXINT

Default value: 2147483647

### The `“minimum-uid”` property

      “minimum-uid”              guint

Minimum UID for non-system users.

Owner: OobsUsersConfig

Flags: Read / Write

Allowed values: <= G_MAXINT

Default value: 2147483647

## See Also

OobsUser