blob: 062efd318aae12254b2295dd5666edb9eb7201d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include "ldapuser.h"
mystring LDAPUser::getGidByUserName( const mystring &userName) {
mystring filter = L"(&(uid=";
filter.append( userName);
filter.append( L")(objectClass=posixAccount))");
return queryAttr( filter, L"gidNumber");
}
mystring
LDAPUser::getGroupByGid( const mystring& gid) {
mystring filter = L"(&(gidNumber=" + gid + L")(objectClass=posixGroup))";
mystring result = queryAttr( filter, L"cn");
if (result == L"") {
return gid;
}
return result;
}
stringSet
LDAPUser::getGroupsByUserName( const mystring& user, const mystring& gid) {
mystring filter = L"(&(|(gidNumber=" + gid + L")(memberUid=" + user + L"))(objectClass=posixGroup))";
stringSet list1 = queryListOfAttr( filter, L"cn");
return list1;
}
stringSet
LDAPUser::getUserNames() {
mystring filter = L"(objectClass=posixAccount)";
return queryListOfAttr( filter, L"uid");
}
stringSet
LDAPUser::getGroupNames() {
mystring filter = L"(objectClass=posixGroup)";
return queryListOfAttr( filter, L"cn");
}
stringMap
LDAPUser::getAttribsByUserName( const mystring &userName, const stringSet attribs) {
mystring filter = L"(&(uid=";
filter.append( userName);
filter.append( L")(objectClass=posixAccount))");
return querySetOfAttrs( filter, attribs);
}
|