OobsUser

## OobsUser OobsUser — Object that represents an individual user |

## Synopsis

                        OobsUser;
                        OobsUserClass;
    enum                OobsUserHomeFlags;
    OobsUser*           oobs_user_new                       (const gchar *name);
    const gchar*        oobs_user_get_login_name            (OobsUser *user);
    void                oobs_user_set_password              (OobsUser *user,
                                                             const gchar *password);
    uid_t               oobs_user_get_uid                   (OobsUser *user);
    void                oobs_user_set_uid                   (OobsUser *user,
                                                             uid_t uid);
    OobsGroup*          oobs_user_get_main_group            (OobsUser *user);
    void                oobs_user_set_main_group            (OobsUser *user,
                                                             OobsGroup *main_group);
    const gchar*        oobs_user_get_home_directory        (OobsUser *user);
    void                oobs_user_set_home_directory        (OobsUser *user,
                                                             const gchar *home_directory);
    const gchar*        oobs_user_get_shell                 (OobsUser *user);
    void                oobs_user_set_shell                 (OobsUser *user,
                                                             const gchar *shell);
    const gchar*        oobs_user_get_full_name             (OobsUser *user);
    const gchar*        oobs_user_get_full_name_fallback    (OobsUser *user);
    void                oobs_user_set_full_name             (OobsUser *user,
                                                             const gchar *full_name);
    const gchar*        oobs_user_get_room_number           (OobsUser *user);
    void                oobs_user_set_room_number           (OobsUser *user,
                                                             const gchar *room_number);
    const gchar*        oobs_user_get_work_phone_number     (OobsUser *user);
    void                oobs_user_set_work_phone_number     (OobsUser *user,
                                                             const gchar *phone_number);
    const gchar*        oobs_user_get_home_phone_number     (OobsUser *user);
    void                oobs_user_set_home_phone_number     (OobsUser *user,
                                                             const gchar *phone_number);
    const gchar*        oobs_user_get_other_data            (OobsUser *user);
    void                oobs_user_set_other_data            (OobsUser *user,
                                                             const gchar *data);
    gboolean            oobs_user_get_password_empty        (OobsUser *user);
    void                oobs_user_set_password_empty        (OobsUser *user,
                                                             gboolean empty);
    gboolean            oobs_user_get_password_disabled     (OobsUser *user);
    void                oobs_user_set_password_disabled     (OobsUser *user,
                                                             gboolean disabled);
    gboolean            oobs_user_get_encrypted_home        (OobsUser *user);
    void                oobs_user_set_encrypted_home        (OobsUser *user,
                                                             gboolean encrypted_home);
    void                oobs_user_set_home_flags            (OobsUser *user,
                                                             OobsUserHomeFlags home_flags);
    const gchar*        oobs_user_get_locale                (OobsUser *user);
    void                oobs_user_set_locale                (OobsUser *user,
                                                             const gchar *locale);
    gboolean            oobs_user_get_active                (OobsUser *user);
    gboolean            oobs_user_is_root                   (OobsUser *user);
    gboolean            oobs_user_is_in_group               (OobsUser *user,
                                                             OobsGroup *group);

## Object Hierarchy

      GObject
       +----OobsObject
             +----OobsUser

## Properties

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

## Description

## Details

### OobsUser

    typedef struct _OobsUser OobsUser;

### OobsUserClass

    typedef struct {
      OobsObjectClass parent_class;

      void (*_oobs_padding1) (void);
      void (*_oobs_padding2) (void);
      void (*_oobs_padding3) (void);
      void (*_oobs_padding4) (void);
    } OobsUserClass;

### enum OobsUserHomeFlags

    typedef enum {
      OOBS_USER_REMOVE_HOME  = 1,
      OOBS_USER_CHOWN_HOME   = 1 << 1,
      OOBS_USER_COPY_HOME    = 1 << 2,
      OOBS_USER_ERASE_HOME   = 1 << 3
    } 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.

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

### oobs_user_new ()

    OobsUser*           oobs_user_new                       (const gchar *name);

Returns a new user with the given login name.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

`user` : |
Returns : |

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

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

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

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

`user` : | An OobsUser.
`group` : | An OobsGroup.
Returns : | `TRUE` if `user` is in `group`, `FALSE` otherwise.

## Property Details

### The `"active"` property

      "active"                   gboolean              : Read

Whether the user is active.

Default value: FALSE

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

      "encrypted-home"           gboolean              : Read / Write

Whether user's home is encrypted.

Default value: FALSE

### The `"full-name"` property

      "full-name"                gchar*                : Read / Write

User's full name.

Default value: NULL

### The `"home-directory"` property

      "home-directory"           gchar*                : Read / Write

Home directory for the user.

Default value: NULL

### The `"home-flags"` property

      "home-flags"               OobsUserHomeFlags     : Read / Write

Flags affecting home directory treatment.

### The `"home-phone"` property

      "home-phone"               gchar*                : Read / Write

User's home phone.

Default value: NULL

### The `"locale"` property

      "locale"                   gchar*                : Read / Write

Preferred locale for the user.

Default value: NULL

### The `"name"` property

      "name"                     gchar*                : Read / Write / Construct Only

Login name for the user.

Default value: NULL

### The `"other-data"` property

      "other-data"               gchar*                : Read / Write

Aditional data for the user.

Default value: NULL

### The `"password"` property

      "password"                 gchar*                : Read / Write

Password for the user.

Default value: NULL

### The `"password-disabled"` property

      "password-disabled"        gboolean              : Read / Write

Whether user is forbidden logging in.

Default value: FALSE

### The `"password-empty"` property

      "password-empty"           gboolean              : Read / Write

Whether user password is empty.

Default value: FALSE

### The `"room-number"` property

      "room-number"              gchar*                : Read / Write

User's room number.

Default value: NULL

### The `"shell"` property

      "shell"                    gchar*                : Read / Write

Default shell for the user.

Default value: NULL

### The `"uid"` property

      "uid"                      guint                 : Read / Write

UID for the user.

Allowed values: <= G_MAXINT

Default value: 2147483647

### The `"work-phone"` property

      "work-phone"               gchar*                : Read / Write

User's work phone.

Default value: NULL

## See Also

OobsUsersConfig