2 * Copyright (c) 1998 Denis Perchine <dyp@perchine.com>
3 * Copyright (c) 2004 Szombathelyi GyĂśrgy <gyurco@freemail.hu>
4 * Maintained by Adriaan de Groot <groot@kde.org>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License version 2 as published by the Free Software Foundation.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
24 #include <sys/types.h>
28 #include <QSharedDataPointer>
34 class KU_Group_Private
: public QSharedData
56 KU_Group(KU_Group
*group
);
63 bool operator==(const KU_Group
&other
) const;
64 void copy(const KU_Group
*group
);
66 KU_PROPERTY(int, Caps
);
68 KU_PROPERTY(QString
, Name
);
69 KU_PROPERTY(QString
, Pwd
);
70 KU_PROPERTY(gid_t
, GID
);
73 KU_PROPERTY(SID
, SID
);
74 KU_PROPERTY(int, Type
);
75 KU_PROPERTY(QString
, DisplayName
);
76 KU_PROPERTY(QString
, Desc
);
78 bool addUser(const QString
&name
);
79 bool removeUser(const QString
&name
);
80 bool lookup_user(const QString
&name
) const;
82 QString
user(uint i
) const;
85 QSharedDataPointer
<KU_Group_Private
> d
;
88 class KU_Groups
: public QList
<KU_Group
> {
97 typedef QList
<KU_Group
> AddList
;
98 typedef QList
<int> DelList
;
99 typedef QMap
<int,KU_Group
> ModList
;
105 KU_Groups( KU_PrefsBase
*cfg
);
106 virtual ~KU_Groups();
108 int getCaps() const { return caps
; }
109 const QString
&getDOMSID() const;
111 int lookup( const QString
&name
) const;
112 int lookup( gid_t gid
) const;
113 int lookup_sam( const SID
&sid
) const;
114 int lookup_sam( const QString
&sid
) const;
115 int lookup_sam( uint rid
) const;
117 void add(const KU_Group
&group
);
119 void mod(int index
, const KU_Group
&newgroup
);
127 virtual gid_t
first_free() const;
128 virtual uint
first_free_sam() const;
129 virtual bool reload() = 0;
130 virtual bool dbcommit() = 0;
132 const QString
&errorString() const { return mErrorString
; }
133 const QString
&errorDetails() const { return mErrorDetails
; }
138 QString mErrorString
, mErrorDetails
;
147 #endif // _KU_GROUP_H_