14#include <kcoreaddons_export.h>
16#include <QSharedDataPointer>
19#include <qcontainerfwd.h>
27struct WindowsSIDWrapper;
40#define KCOREADDONS_UINT_MAX (std::numeric_limits<uint>::max)()
155 static KUserId currentUserId();
160 static KUserId currentEffectiveUserId();
195 static KGroupId currentEffectiveGroupId();
201 return qHash(
id.nativeId(), seed);
205 return qHash(
id.nativeId(), seed);
209KCOREADDONS_EXPORT
size_t qHash(
const KUserId &
id,
size_t seed = 0);
210KCOREADDONS_EXPORT
size_t qHash(
const KGroupId &
id,
size_t seed = 0);
246 explicit KUser(UIDMode mode = UseEffectiveUID);
253 explicit KUser(K_UID uid);
276 explicit KUser(
const char *name);
285 explicit KUser(
const passwd *p);
305 bool operator==(
const KUser &user)
const;
311 bool operator!=(
const KUser &user)
const;
318 bool isValid()
const;
330 bool isSuperUser()
const;
369 QStringList groupNames(uint maxCount = KCOREADDONS_UINT_MAX)
const;
386 QVariant property(UserProperty which)
const;
397 static QList<KUser> allUsers(uint maxCount = KCOREADDONS_UINT_MAX);
403 static QStringList allUserNames(uint maxCount = KCOREADDONS_UINT_MAX);
409Q_DECLARE_TYPEINFO(
KUser, Q_RELOCATABLE_TYPE);
493 bool operator==(
const KUserGroup &group)
const;
500 bool operator!=(
const KUserGroup &group)
const;
508 bool isValid()
const;
523 QList<KUser> users(uint maxCount = KCOREADDONS_UINT_MAX)
const;
529 QStringList userNames(uint maxCount = KCOREADDONS_UINT_MAX)
const;
546 static QStringList allGroupNames(uint maxCount = KCOREADDONS_UINT_MAX);
552Q_DECLARE_TYPEINFO(
KUserGroup, Q_RELOCATABLE_TYPE);
554#if !defined(Q_OS_WIN)
559 return id != NativeType(-1);
564 return id == other.id;
569 return id != other.id;
Represents a group on your system.
KUserGroup(const group *g)
Creates an object from a group structure.
bool operator!=(const KUserGroup &group) const
Two KUserGroup objects are not equal if their gid()s are not identical.
bool operator==(const KUserGroup &group) const
Two KUserGroup objects are equal if their gid()s are identical.
Represents a user on your system.
bool operator!=(const KUser &user) const
Two KUser objects are not equal if userId() are not identical.
bool operator==(const KUser &user) const
Two KUser objects are equal if the userId() are identical.
@ UseEffectiveUID
Use the effective user id.
@ UseRealUserID
Use the real user id.
KTEXTEDITOR_EXPORT size_t qHash(KTextEditor::Cursor cursor, size_t seed=0) noexcept
QString number(double n, char format, int precision)
A platform independent group ID.
KGroupId()
Creates an invalid KGroupId.
KGroupId(K_GID gid)
Creates an KGroupId from the native group ID type.
A platform independent user ID.
KUserId()
Creates an invalid KUserId.
KUserId(K_UID uid)
Creates an KUserId from the native user ID type.
A platform independent user or group ID.
bool operator==(const KUserOrGroupId &other) const
NativeType nativeId() const
KUserOrGroupId(NativeType nativeId)
Creates a KUserOrGroupId from a native user/group ID.
bool operator!=(const KUserOrGroupId &other) const
KUserOrGroupId(const KUserOrGroupId< T > &other)
Copy constructor.
KUserOrGroupId()
Creates an invalid KUserOrGroupId.