kuser.h
/*
* KUser - represent a user/account
* Copyright (C) 2002-2003 Tim Jansen <tim@tjansen.de>
* Copyright (C) 2003 Oswald Buddenhagen <ossi@kde.org>
* Copyright (C) 2004 Jan Schaefer <j_schaef@informatik.uni-kl.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KUSER_H
#define KUSER_H
#include "ksharedptr.h"
class KUserGroup;
class QString;
class QStringList;
class KUserPrivate;
struct passwd;
template <class T> class QValueList;
class KDECORE_EXPORT KUser {
public:
enum UIDMode {
UseEffectiveUID,
UseRealUserID
};
// XXX KDE4: Make this explicit
KUser(UIDMode mode = UseEffectiveUID);
// XXX KDE4: Make this explicit; give parameter as uid_t instead of "long"
KUser(long uid);
// XXX KDE4: Make this explicit
KUser(const QString& name);
// XXX KDE4: Make this explicit
KUser(const char *name);
// XXX KDE4: Make this explicit
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;
// XXX KDE4: Make this return uid_t
long uid() const;
// XXX KDE4: Make this return gid_t
long gid() const;
bool isSuperUser() const;
QString loginName() const;
QString fullName() const;
QString roomNumber() const;
QString workPhone() const;
QString homePhone() const;
QString homeDir() const;
QString shell() const;
QValueList<KUserGroup> groups() const;
QStringList groupNames() const;
~KUser();
static QValueList<KUser> allUsers();
static QStringList allUserNames();
private:
KSharedPtr<KUserPrivate> d;
void fillPasswd(struct passwd* p);
void fillName(const char* name);
};
class KUserGroupPrivate;
struct group;
class KDECORE_EXPORT KUserGroup {
public:
explicit KUserGroup(KUser::UIDMode mode = KUser::UseEffectiveUID);
// XXX KDE4: Give parameter as gid_t instead of "long"
explicit KUserGroup(long gid);
explicit KUserGroup(const QString& name);
explicit KUserGroup(const char *name);
explicit KUserGroup(struct group *g);
KUserGroup(const KUserGroup & group);
KUserGroup& operator =(const KUserGroup& group);
bool operator ==(const KUserGroup& group) const;
bool operator !=(const KUserGroup& group) const;
bool isValid() const;
// XXX KDE4: Return gid_t instead of "long"
long gid() const;
QString name() const;
const QValueList<KUser>& users() const;
QStringList userNames() const;
~KUserGroup();
static QValueList<KUserGroup> allGroups();
static QStringList allGroupNames();
private:
KSharedPtr<KUserGroupPrivate> d;
void fillGroup(struct group* g);
void fillName(const char* name);
};
#endif
KSharedPtr< KUserPrivate >
KUser::UseEffectiveUID
Use the effective user id.
Definition: kuser.h:50
KUserGroup
Represents a group on your system.
Definition: kuser.h:256
KUser
Represents a user on your system.
Definition: kuser.h:45
KUser::UIDMode
UIDMode
Definition: kuser.h:49

KDE Home | KDE Accessibility Home | Description of Access Keys