You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB

#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);
}