• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Types | Public Member Functions | Static Public Member Functions | List of all members
KUser Class Reference

#include <kuser.h>

Public Types

enum  UIDMode { UseEffectiveUID , UseRealUserID }
 

Public Member Functions

 KUser (UIDMode mode=UseEffectiveUID)
 
 KUser (long uid)
 
 KUser (const TQString &name)
 
 KUser (const char *name)
 
 KUser (struct passwd *p)
 
 KUser (const KUser &user)
 
KUser & operator= (const KUser &user)
 
bool operator== (const KUser &user) const
 
bool operator!= (const KUser &user) const
 
bool isValid () const
 
long uid () const
 
long gid () const
 
bool isSuperUser () const
 
TQString loginName () const
 
TQString fullName () const
 
TQString roomNumber () const
 
TQString workPhone () const
 
TQString homePhone () const
 
TQString homeDir () const
 
TQString shell () const
 
TQValueList< KUserGroup > groups () const
 
TQStringList groupNames () const
 
 ~KUser ()
 

Static Public Member Functions

static TQValueList< KUser > allUsers ()
 
static TQStringList allUserNames ()
 

Detailed Description

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@t.nosp@m.jans.nosp@m.en.de
Since
3.2

Definition at line 45 of file kuser.h.

Member Enumeration Documentation

◆ UIDMode

enum KUser::UIDMode
Enumerator
UseEffectiveUID 

Use the effective user id.

UseRealUserID 

Use the real user id.

Definition at line 49 of file kuser.h.

Constructor & Destructor Documentation

◆ KUser() [1/6]

KUser::KUser ( UIDMode  mode = UseEffectiveUID)

Creates an object that contains information about the current user.

(as returned by getuid(2) or geteuid(2), taking $LOGNAME/$USER into account).

Parameters
modeif 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.

Definition at line 68 of file kuser.cpp.

◆ KUser() [2/6]

KUser::KUser ( long  uid)

Creates an object for the user with the given user id.

If the user does not exist isValid() will return false.

Parameters
uidthe user id

Definition at line 82 of file kuser.cpp.

◆ KUser() [3/6]

KUser::KUser ( const TQString &  name)

Creates an object that contains information about the user with the given name.

If the user does not exist isValid() will return false.

Parameters
namethe name of the user

Definition at line 86 of file kuser.cpp.

◆ KUser() [4/6]

KUser::KUser ( const char *  name)

Creates an object that contains information about the user with the given name.

If the user does not exist isValid() will return false.

Parameters
namethe name of the user

Definition at line 90 of file kuser.cpp.

◆ KUser() [5/6]

KUser::KUser ( struct passwd *  p)

Creates an object from a passwd structure.

If the pointer is null isValid() will return false.

Parameters
pthe passwd structure to create the user from

Definition at line 94 of file kuser.cpp.

◆ KUser() [6/6]

KUser::KUser ( const KUser &  user)

Creates an object from another KUser object.

Parameters
userthe user to create the new object from

Definition at line 98 of file kuser.cpp.

◆ ~KUser()

KUser::~KUser ( )

Destructor.

Definition at line 271 of file kuser.cpp.

Member Function Documentation

◆ allUserNames()

TQStringList KUser::allUserNames ( )
static

Returns all user names of the system.

Returns
all user names of the system.

Definition at line 257 of file kuser.cpp.

◆ allUsers()

TQValueList< KUser > KUser::allUsers ( )
static

Returns all users of the system.

Returns
all users of the system.

Definition at line 243 of file kuser.cpp.

◆ fullName()

TQString KUser::fullName ( ) const

The full name of the user.

Returns
the full name of the user or TQString::null if user is invalid

Definition at line 174 of file kuser.cpp.

◆ gid()

long KUser::gid ( ) const

Returns the group id of the user.

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

Definition at line 156 of file kuser.cpp.

◆ groupNames()

TQStringList KUser::groupNames ( ) const

Returns all group names of the user.

Returns
all group names of the user

Definition at line 229 of file kuser.cpp.

◆ groups()

TQValueList< KUserGroup > KUser::groups ( ) const

Returns all groups of the user.

Returns
all groups of the user

Definition at line 216 of file kuser.cpp.

◆ homeDir()

TQString KUser::homeDir ( ) const

The path to the user's home directory.

Returns
the home directory of the user or TQString::null if the user is invalid

Definition at line 202 of file kuser.cpp.

◆ homePhone()

TQString KUser::homePhone ( ) const

The user's home phone.

Returns
the home phone of the user or TQString::null if not set or the user is invalid

Definition at line 195 of file kuser.cpp.

◆ isSuperUser()

bool KUser::isSuperUser ( ) const

Checks whether the user it the super user (root).

Returns
true if the user is root

Definition at line 163 of file kuser.cpp.

◆ isValid()

bool KUser::isValid ( ) const

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

Definition at line 145 of file kuser.cpp.

◆ loginName()

TQString KUser::loginName ( ) const

The login name of the user.

Returns
the login name of the user or TQString::null if user is invalid

Definition at line 167 of file kuser.cpp.

◆ operator!=()

bool KUser::operator!= ( const KUser &  user) const

Two KUser objects are not equal if either isValid() is not true or uid() are not identical.

Definition at line 118 of file kuser.cpp.

◆ operator=()

KUser & KUser::operator= ( const KUser &  user)

Copies a user.

Parameters
userthe user to copy
Returns
this object

Definition at line 103 of file kuser.cpp.

◆ operator==()

bool KUser::operator== ( const KUser &  user) const

Two KUser objects are equal if isValid() is true and the uid() are identical.

Definition at line 109 of file kuser.cpp.

◆ roomNumber()

TQString KUser::roomNumber ( ) const

The user's room number.

Returns
the room number of the user or TQString::null if not set or the user is invalid

Definition at line 181 of file kuser.cpp.

◆ shell()

TQString KUser::shell ( ) const

The path to the user's login shell.

Returns
the login shell of the user or TQString::null if the user is invalid

Definition at line 209 of file kuser.cpp.

◆ uid()

long KUser::uid ( ) const

Returns the user id of the user.

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

Definition at line 149 of file kuser.cpp.

◆ workPhone()

TQString KUser::workPhone ( ) const

The user's work phone.

Returns
the work phone of the user or TQString::null if not set or the user is invalid

Definition at line 188 of file kuser.cpp.


The documentation for this class was generated from the following files:
  • kuser.h
  • kuser.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.