KUser Class Reference
from PyKDE4.kdecore import *
Detailed Description
\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.
Enumerations | |
| UIDMode | { UseEffectiveUID, UseRealUserID } |
| UserProperty | { FullName, RoomNumber, WorkPhone, HomePhone } |
Methods | |
| __init__ (self, KUser.UIDMode mode=KUser.UseEffectiveUID) | |
| __init__ (self, uid_t uid) | |
| __init__ (self, QString name) | |
| __init__ (self, QString name) | |
| __init__ (self, KUser user) | |
| QString | faceIconPath (self) |
| QString | fullName (self) |
| gid_t | gid (self) |
| QStringList | groupNames (self) |
| [KUserGroup] | groups (self) |
| QString | homeDir (self) |
| bool | isSuperUser (self) |
| bool | isValid (self) |
| QString | loginName (self) |
| bool | operator != (self, KUser user) |
| bool | operator == (self, KUser user) |
| QVariant | property (self, KUser.UserProperty which) |
| QString | shell (self) |
| uid_t | uid (self) |
Static Methods | |
| QStringList | allUserNames () |
| [KUser] | allUsers () |
Method Documentation
| __init__ | ( | self, | ||
| KUser.UIDMode | mode=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).
- Parameters:
-
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.
| __init__ | ( | self, | ||
| uid_t | uid | |||
| ) |
Creates an object for the user with the given user id. If the user does not exist isValid() will return false.
- Parameters:
-
uid the user id
| __init__ | ( | self, | ||
| QString | 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:
-
name the name of the user
| __init__ | ( | self, | ||
| QString | 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:
-
name the name of the user
| __init__ | ( | self, | ||
| KUser | user | |||
| ) |
Creates an object from another KUser object
- Parameters:
-
user the user to create the new object from
| QString faceIconPath | ( | self ) |
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
| QString fullName | ( | self ) |
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_t gid | ( | self ) |
Returns the group id of the user.
- Returns:
- the id of the group or -1 if user is invalid
| QStringList groupNames | ( | self ) |
Returns all group names of the user
- Returns:
- all group names of the user
| [KUserGroup] groups | ( | self ) |
Returns all groups of the user
- Returns:
- all groups of the user
| QString homeDir | ( | self ) |
The path to the user's home directory.
- Returns:
- the home directory of the user or QString() if the user is invalid
| bool isSuperUser | ( | self ) |
Checks whether the user is the super user (root).
- Returns:
- true if the user is root
| bool isValid | ( | self ) |
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
| QString loginName | ( | self ) |
The login name of the user.
- Returns:
- the login name of the user or QString() if user is invalid
| bool operator != | ( | self, | ||
| KUser | user | |||
| ) |
Two KUser objects are not equal if uid() are not identical. Invalid users always compare unequal.
| bool operator == | ( | self, | ||
| KUser | user | |||
| ) |
Two KUser objects are equal if the uid() are identical. Invalid users never compare equal.
| QVariant property | ( | self, | ||
| KUser.UserProperty | which | |||
| ) |
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
| QString shell | ( | self ) |
The path to the user's login shell.
- Returns:
- the login shell of the user or QString() if the user is invalid
| uid_t uid | ( | self ) |
Returns the user id of the user.
- Returns:
- the id of the user or -1 if user is invalid
Static Method Documentation
| QStringList allUserNames | ( | ) |
Returns all user names of the system.
- Returns:
- all user names of the system.
| [KUser] allUsers | ( | ) |
Returns all users of the system.
- Returns:
- all users of the system.
Enumeration Documentation
| UIDMode |
- Enumerator:
-
UseEffectiveUID UseRealUserID
| UserProperty |
- Enumerator:
-
FullName RoomNumber WorkPhone HomePhone
KDE 4.7 PyKDE API Reference