# class KUser

###

Module | kdecore
Namespace |
Class | KUser
Inherits |

\class KUser kuser.h <KUser>

Represents a user on your system

This class represents a user on your system. You can either get information about the current user, of fetch information about a user on the system. Instances of this class will be explicitly shared, so copying objects is very cheap and you can safely pass objects by value.

Author Tim Jansen <tim@tjansen.de>

### enums

- UIDMode { UseEffectiveUID, UseRealUserID }
- UserProperty { FullName, RoomNumber, WorkPhone, HomePhone }

enum details

### methods

- KUser (mode)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  mode | KUser.UIDMode | KUser.UseEffectiveUID

  Creates an object that contains information about the current user. (as returned by getuid(2) or geteuid(2), taking $LOGNAME/$USER into account).

  mode - if #UseEffectiveUID is passed the effective user is returned. If #UseRealUserID is passed the real user will be returned. The real UID will be different than the effective UID in setuid programs; in such a case use the effective UID for checking permissions, and the real UID for displaying information about the user.

- KUser (uid)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  uid | K_UID |

  Creates an object for the user with the given user id. If the user does not exist isValid() will return false.

  uid - the user id

- KUser (name)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  name | QString |

  Creates an object that contains information about the user with the given name. If the user does not exist isValid() will return false.

  name - the name of the user

- KUser (name)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  name | char |

  Creates an object that contains information about the user with the given name. If the user does not exist isValid() will return false.

  name - the name of the user

- KUser (p)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  p | passwd |

  Creates an object from a passwd structure. If the pointer is null isValid() will return false.

  p - the passwd structure to create the user from

- KUser (user)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  user | KUser |

  Creates an object from another KUser object

  user - the user to create the new object from

- KUser (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | KUser.UIDMode | KUser.UseEffectiveUID

- KUser (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | K_UID |

- KUser (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |

- KUser (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | char |

- KUser (a0)

  returns ctor
  Not implemented
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | passwd |

- allUserNames ( )

  returns QStringList
  static

  Returns all user names of the system. Returns all user names of the system.

- allUsers ( )

  returns QList<KUser>
  static

  Returns all users of the system. Returns all users of the system.

- faceIconPath ( )

  returns QString

  The path to the user's face file. Returns the path to the user's face file or QString() if no face has been set

- fullName ( )

  returns QString

  The full name of the user. Returns the full name of the user or QString() if user is invalid Deprecated use property(KUser.FullName) instead

- gid ( )

  returns K_GID

  Returns the group id of the user. Returns the id of the group or -1 if user is invalid

- groupNames ( )

  returns QStringList

  Returns all group names of the user Returns all group names of the user

- groups ( )

  returns QList<KUserGroup>

  Returns all groups of the user Returns all groups of the user

- homeDir ( )

  returns QString

  The path to the user's home directory. Returns the home directory of the user or QString() if the user is invalid

- isSuperUser ( )

  returns bool

  Checks whether the user is the super user (root). Returns true if the user is root

- isValid ( )

  returns bool

  Returns true if the user is valid. A KUser object can be invalid if you created it with an non-existing uid or name. Returns true if the user is valid

- loginName ( )

  returns QString

  The login name of the user. Returns the login name of the user or QString() if user is invalid

- operator != (user)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  user | KUser |

  Two KUser objects are not equal if uid() are not identical. Invalid users always compare unequal.

- operator == (user)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  user | KUser |

  Two KUser objects are equal if the uid() are identical. Invalid users never compare equal.

- property (which)

  returns QVariant

  Argument | Type | Default
  --- | --- | ---
  which | KUser.UserProperty |

  Returns an extended property.

  Under Windows, RoomNumber, WorkPhone and HomePhone are unsupported.

  Returns a QVariant with the value of the property or an invalid QVariant, if the property is not set

- shell ( )

  returns QString

  The path to the user's login shell. Returns the login shell of the user or QString() if the user is invalid

- uid ( )

  returns K_UID

  Returns the user id of the user. Returns the id of the user or -1 if user is invalid

### enums - detail

- UIDMode { UseEffectiveUID, UseRealUserID }

  | UseEffectiveUID | - | - |
  | UseRealUserID | - | - |

- UserProperty { FullName, RoomNumber, WorkPhone, HomePhone }

  | FullName | - | - |
  | RoomNumber | - | - |
  | WorkPhone | - | - |
  | HomePhone | - | - |