KUser Class Reference
from PyKDE5.kcoreaddons 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.UIDMode.UseEffectiveUID) | |
__init__ (self, long uid) | |
__init__ (self, QString name) | |
__init__ (self, QString name) | |
__init__ (self, KUser user) | |
__init__ (self, KUserId uid) | |
QString | faceIconPath (self) |
KGroupId | groupId (self) |
QStringList | groupNames (self, long maxCount=0xffffffff) |
[KUserGroup] | groups (self, long maxCount=0xffffffff) |
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) |
KUserId | userId (self) |
Static Methods | |
QStringList | allUserNames (long maxCount=0xffffffff) |
[KUser] | allUsers (long maxCount=0xffffffff) |
Method Documentation
__init__ | ( | self, | ||
KUser::UIDMode | mode=KUser.UIDMode.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, | ||
long | uid | |||
) |
Creates an object for the user with the given user id. If the KUserId object is invalid this one will be, too.
- 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
__init__ | ( | self, | ||
KUserId | uid | |||
) |
Creates an object for the user with the given user id. If the KUserId object is invalid this one will be, too.
- Parameters:
-
uid the user id
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
KGroupId groupId | ( | self ) |
- Returns:
- the native user id of the user.
QStringList groupNames | ( | self, | ||
long | maxCount=0xffffffff | |||
) |
- Parameters:
-
maxCount the maximum number of groups to return
- Returns:
- all group names of the user
[KUserGroup] groups | ( | self, | ||
long | maxCount=0xffffffff | |||
) |
- Parameters:
-
maxCount the maximum number of groups to return
- 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 | |||
) |
bool operator == | ( | self, | ||
KUser | user | |||
) |
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
KUserId userId | ( | self ) |
- Returns:
- the native user id of the user.
Static Method Documentation
QStringList allUserNames | ( | long | maxCount=0xffffffff | |
) |
- Parameters:
-
maxCount the maximum number of users to return
- Returns:
- all user names of the system.
[KUser] allUsers | ( | long | maxCount=0xffffffff | |
) |
- Parameters:
-
maxCount the maximum number of users to return
- Returns:
- all users of the system.
Enumeration Documentation
UIDMode |
- Enumerator:
-
UseEffectiveUID UseRealUserID
UserProperty |
- Enumerator:
-
FullName RoomNumber WorkPhone HomePhone