## OobsUser

OobsUser — Object that represents an individual user

## Functions

OobsUser * | oobs_user_new ()
const gchar * | oobs_user_get_login_name ()
void | oobs_user_set_password ()
uid_t | oobs_user_get_uid ()
void | oobs_user_set_uid ()
OobsGroup * | oobs_user_get_main_group ()
void | oobs_user_set_main_group ()
const gchar * | oobs_user_get_home_directory ()
void | oobs_user_set_home_directory ()
const gchar * | oobs_user_get_shell ()
void | oobs_user_set_shell ()
const gchar * | oobs_user_get_full_name ()
const gchar * | oobs_user_get_full_name_fallback ()
void | oobs_user_set_full_name ()
const gchar * | oobs_user_get_room_number ()
void | oobs_user_set_room_number ()
const gchar * | oobs_user_get_work_phone_number ()
void | oobs_user_set_work_phone_number ()
const gchar * | oobs_user_get_home_phone_number ()
void | oobs_user_set_home_phone_number ()
const gchar * | oobs_user_get_other_data ()
void | oobs_user_set_other_data ()
gboolean | oobs_user_get_password_empty ()
void | oobs_user_set_password_empty ()
gboolean | oobs_user_get_password_disabled ()
void | oobs_user_set_password_disabled ()
gboolean | oobs_user_get_encrypted_home ()
void | oobs_user_set_encrypted_home ()
void | oobs_user_set_home_flags ()
const gchar * | oobs_user_get_locale ()
void | oobs_user_set_locale ()
gboolean | oobs_user_get_active ()
gboolean | oobs_user_is_root ()
gboolean | oobs_user_is_in_group ()

## Properties

gboolean | active | Read
gboolean | encrypted-home | Read / Write
char * | full-name | Read / Write
char * | home-directory | Read / Write
OobsUserHomeFlags | home-flags | Read / Write
char * | home-phone | Read / Write
char * | locale | Read / Write
char * | name | Read / Write / Construct Only
char * | other-data | Read / Write
char * | password | Read / Write
gboolean | password-disabled | Read / Write
gboolean | password-empty | Read / Write
char * | room-number | Read / Write
char * | shell | Read / Write
guint | uid | Read / Write
char * | work-phone | Read / Write

## Types and Values

enum | OobsUserHomeFlags

## Object Hierarchy

        GFlags
        ╰── OobsUserHomeFlags
        GObject
        ╰── OobsObject
            ╰── OobsUser

## Description

## Functions

### oobs_user_new ()

    OobsUser *
    oobs_user_new (const gchar *name);

Returns a new user with the given login name.

#### Parameters

name | login name for the new user. |

#### Returns

A newly allocated OobsUser.

### oobs_user_get_login_name ()

    const gchar *
    oobs_user_get_login_name (OobsUser *user);

Returns the login name of the user.

#### Parameters

user | An OobsUser. |

#### Returns

A pointer to the login name as a string. This string must not be freed, modified or stored.

### oobs_user_set_password ()

    void
    oobs_user_set_password (OobsUser *user,
                            const gchar *password);

Sets a new password for the user. This password will be interpreted as clean text and encrypted by the backends using PAM. Be careful deleting the passed string after using this function.

#### Parameters

user | An OobsUser. |
password | a new password for the user. |

### oobs_user_get_uid ()

    uid_t
    oobs_user_get_uid (OobsUser *user);

Returns the UID for this user.

#### Parameters

user | An OobsUser. |

#### Returns

user UID.

### oobs_user_set_uid ()

    void
    oobs_user_set_uid (OobsUser *user,
                       uid_t uid);

Sets a new UID for the user. files formerly owned by the user will not be chowned to the new UID, be careful using this function.

#### Parameters

user | An OobsUser. |
uid | a new UID for the user. |

### oobs_user_get_main_group ()

    OobsGroup *
    oobs_user_get_main_group (OobsUser *user);

Returns the main group of this user.

#### Parameters

user | An OobsUser. |

#### Returns

main group for the user. Release reference when no longer needed.

### oobs_user_set_main_group ()

    void
    oobs_user_set_main_group (OobsUser *user,
                              OobsGroup *main_group);

Sets the main group for the user.

#### Parameters

user | An OobsUser. |
main_group | an OobsGroup, new main group for the user. |

### oobs_user_get_home_directory ()

    const gchar *
    oobs_user_get_home_directory (OobsUser *user);

Returns the home directory path of the user.

#### Parameters

user | An OobsUser. |

#### Returns

A pointer to the home directory as a string. This string must not be freed, modified or stored.

### oobs_user_set_home_directory ()

    void
    oobs_user_set_home_directory (OobsUser *user,
                                  const gchar *home_directory);

Sets a new home directory for the user. files stored in the previous home directory will not be moved, be careful using this function.

#### Parameters

user | An OobsUser. |
home_directory | new home directory path for the user. |

### oobs_user_get_shell ()

    const gchar *
    oobs_user_get_shell (OobsUser *user);

Returns the default shell used by the user.

#### Parameters

user | An OobsUser. |

#### Returns

A pointer to the default shell as a string. This string must not be freed, modified or stored.

### oobs_user_set_shell ()

    void
    oobs_user_set_shell (OobsUser *user,
                         const gchar *shell);

Sets a new default shell for the user.

#### Parameters

user | An OobsUser. |
shell | a new default shell for the user. |

### oobs_user_get_full_name ()

    const gchar *
    oobs_user_get_full_name (OobsUser *user);

Returns the first GECOS field, usually the full name of the user.

#### Parameters

user | An OobsUser. |

#### Returns

A pointer to the full name as a string. This string must not be freed, modified or stored.

### oobs_user_get_full_name_fallback ()

    const gchar *
    oobs_user_get_full_name_fallback (OobsUser *user);

Returns the first GECOS field, usually the full name of the user, or the login name if the field is empty.

#### Parameters

user | An OobsUser. |

#### Returns

A pointer to the full name or login name as a string. This string must not be freed, modified or stored.

### oobs_user_set_full_name ()

    void
    oobs_user_set_full_name (OobsUser *user,
                             const gchar *full_name);

Sets a new full name for the user.

#### Parameters

user | An OobsUser. |
full_name | new full name for the user. |

### oobs_user_get_room_number ()

    const gchar *
    oobs_user_get_room_number (OobsUser *user);

Returns the second GECOS field, usually the room number.

#### Parameters

user | An OobsUser. |

#### Returns

A pointer to the room number as a string. This string must not be freed, modified or stored.

### oobs_user_set_room_number ()

    void
    oobs_user_set_room_number (OobsUser *user,
                               const gchar *room_number);

Sets a new room number for the user.

#### Parameters

user | An OobsUser. |
room_number | new room number for the user. |

### oobs_user_get_work_phone_number ()

    const gchar *
    oobs_user_get_work_phone_number (OobsUser *user);

Returns the third GECOS field, usually the work phone number.

#### Parameters

user | An OobsUser. |

#### Returns

A pointer to the work phone number as a string. This string must not be freed, modified or stored.

### oobs_user_set_work_phone_number ()

    void
    oobs_user_set_work_phone_number (OobsUser *user,
                                     const gchar *phone_number);

Sets a new work phone number for the user.

#### Parameters

user | An OobsUser. |
phone_number | new work phone number for the user. |

### oobs_user_get_home_phone_number ()

    const gchar *
    oobs_user_get_home_phone_number (OobsUser *user);

Returns the fourth GECOS field, usually the home phone number.

#### Parameters

user | An OobsUser. |

#### Returns

A pointer to the home phone number as a string. This string must not be freed, modified or stored.

### oobs_user_set_home_phone_number ()

    void
    oobs_user_set_home_phone_number (OobsUser *user,
                                     const gchar *phone_number);

Sets a new home phone number for the user.

#### Parameters

user | An OobsUser. |
phone_number | new home phone number for the user. |

### oobs_user_get_other_data ()

    const gchar *
    oobs_user_get_other_data (OobsUser *user);

Returns the fifth field of GECOS fields, reserved for additional data.

#### Parameters

user | An OobsUser. |

#### Returns

A pointer to the fifth GECOS field as a string. This string must not be freed, modified or stored.

### oobs_user_set_other_data ()

    void
    oobs_user_set_other_data (OobsUser *user,
                              const gchar *data);

Sets the data in the fifth GECOS field.

#### Parameters

user | An OobsUser. |
data | data in the fifth GECOS field. |

### oobs_user_get_password_empty ()

    gboolean
    oobs_user_get_password_empty (OobsUser *user);

Returns whether the current password for `user` is empty.

#### Parameters

user | An OobsUser. |

#### Returns

`TRUE` if `user` is using an empty password, `FALSE` otherwise.

### oobs_user_set_password_empty ()

    void
    oobs_user_set_password_empty (OobsUser *user,
                                  gboolean empty);

Forces an empty password for `user` . (Setting the 'password' property to the empty string is used to keep the current password.)

#### Parameters

user | An OobsUser. |
empty | whether password for `user` should be set to empty. |

### oobs_user_get_password_disabled ()

    gboolean
    oobs_user_get_password_disabled (OobsUser *user);

Returns whether account for `user` is currently disabled, i.e. user is not allowed to log in.

#### Parameters

user | An OobsUser. |

#### Returns

`TRUE` if account is disabled, `FALSE` otherwise.

### oobs_user_set_password_disabled ()

    void
    oobs_user_set_password_disabled (OobsUser *user,
                                     gboolean disabled);

Disable or enable account, allowing or preventing `user` from logging in.

#### Parameters

user | An OobsUser. |
disabled | whether account for `user` should be disabled. |

### oobs_user_get_encrypted_home ()

    gboolean
    oobs_user_get_encrypted_home (OobsUser *user);

Returns whether home directory for `user` is encrypted (e.g. using eCryptfs).

#### Parameters

user | An OobsUser. |

#### Returns

`TRUE` if home is encrypted, `FALSE` otherwise.

### oobs_user_set_encrypted_home ()

    void
    oobs_user_set_encrypted_home (OobsUser *user,
                                  gboolean encrypted_home);

Set whether home directory for `user` should be encrypted. This function should only be used on new users before committing them, and when the system supports it for the change to take effect.

#### Parameters

user | An OobsUser. |
encrypted_home | whether home directory for `user` should be encrypted. |

### oobs_user_set_home_flags ()

    void
    oobs_user_set_home_flags (OobsUser *user,
                              OobsUserHomeFlags home_flags);

Set the flags affecting treatment of the user's home directory (remove home when deleting user, chown directory to user...).

#### Parameters

user | An OobsUser. |
home_flags | how home directory for `user` should be treated. |

### oobs_user_get_locale ()

    const gchar *
    oobs_user_get_locale (OobsUser *user);

### oobs_user_set_locale ()

    void
    oobs_user_set_locale (OobsUser *user,
                          const gchar *locale);

Sets the ISO 639 code representing the current locale for `user` .

#### Parameters

user | An OobsUser. |
locale | Preferred locale for `user` . |

### oobs_user_get_active ()

    gboolean
    oobs_user_get_active (OobsUser *user);

Returns whether the use is currently logged in the system.

#### Parameters

user | An OobsUser |

#### Returns

TRUE if the user is logged in the system.

### oobs_user_is_root ()

    gboolean
    oobs_user_is_root (OobsUser *user);

Checks whether a group is the superuser, according to its name.

#### Parameters

user | An OobsUser. |

#### Returns

`TRUE` if `user` is the root user, `FALSE` otherwise.

### oobs_user_is_in_group ()

    gboolean
    oobs_user_is_in_group (OobsUser *user,
                           OobsGroup *group);

Checks whether a user member of `group` .

#### Parameters

user | An OobsUser. |
group | An OobsGroup. |

#### Returns

`TRUE` if `user` is in `group` , `FALSE` otherwise.

## Types and Values

### enum OobsUserHomeFlags

Determine special behaviors regarding the home directory. Flags only apply to some operations (commit, add or delete user), and have no effect in other cases.

#### Members

OOBS_USER_REMOVE_HOME | When removing an OobsUser, also remove home dir; when committing, if home dir changes, remove old home dir. |
OOBS_USER_CHOWN_HOME | When creating or committing an OobsUser, recursively change the owner of home dir to user and main group. |
OOBS_USER_COPY_HOME | When committing an OobsUser and if home dir changes, copy old home to new path, overwriting files if needed (!). |
OOBS_USER_ERASE_HOME | When creating an OobsUser and a path for home dir is given, or when committing a user and home dir changes, delete already present directory. |

## Property Details

### The `“active”` property

      “active”                   gboolean

Whether the user is active.

Owner: OobsUser

Flags: Read

Default value: FALSE

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

      “encrypted-home”           gboolean

Whether user's home is encrypted.

Owner: OobsUser

Flags: Read / Write

Default value: FALSE

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

      “full-name”                char *

User's full name.

Owner: OobsUser

Flags: Read / Write

Default value: NULL

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

      “home-directory”           char *

Home directory for the user.

Owner: OobsUser

Flags: Read / Write

Default value: NULL

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

      “home-flags”               OobsUserHomeFlags

Flags affecting home directory treatment.

Owner: OobsUser

Flags: Read / Write

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

      “home-phone”               char *

User's home phone.

Owner: OobsUser

Flags: Read / Write

Default value: NULL

### The `“locale”` property

      “locale”                   char *

Preferred locale for the user.

Owner: OobsUser

Flags: Read / Write

Default value: NULL

### The `“name”` property

      “name”                     char *

Login name for the user.

Owner: OobsUser

Flags: Read / Write / Construct Only

Default value: NULL

### The `“other-data”` property

      “other-data”               char *

Aditional data for the user.

Owner: OobsUser

Flags: Read / Write

Default value: NULL

### The `“password”` property

      “password”                 char *

Password for the user.

Owner: OobsUser

Flags: Read / Write

Default value: NULL

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

      “password-disabled”        gboolean

Whether user is forbidden logging in.

Owner: OobsUser

Flags: Read / Write

Default value: FALSE

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

      “password-empty”           gboolean

Whether user password is empty.

Owner: OobsUser

Flags: Read / Write

Default value: FALSE

### The `“room-number”` property

      “room-number”              char *

User's room number.

Owner: OobsUser

Flags: Read / Write

Default value: NULL

### The `“shell”` property

      “shell”                    char *

Default shell for the user.

Owner: OobsUser

Flags: Read / Write

Default value: NULL

### The `“uid”` property

      “uid”                      guint

UID for the user.

Owner: OobsUser

Flags: Read / Write

Allowed values: <= G_MAXINT

Default value: 2147483647

### The `“work-phone”` property

      “work-phone”               char *

User's work phone.

Owner: OobsUser

Flags: Read / Write

Default value: NULL

## See Also

OobsUsersConfig