7 #include <unordered_map> 8 #include <unordered_set> 10 #include "../helpers/String.h" 28 LDAPUsers(
const std::string &dn,
const std::string &password);
37 bool contains(
const std::string &key)
const noexcept {
return m_userSet.contains(key); }
39 friend void testLDAP();
41 using UserMap = std::unordered_map<std::string, std::string>;
45 static void addUserMapCond(UserMap &userMap, std::string_view logname,
46 std::string_view email);
47 static UserMap parseMap(std::string_view mapData);
49 void buildSet(
const std::string &dn,
const std::string &password,
const UserMap &userMap);
51 static std::pair<std::string_view, bool>
52 getMappedUser(
const UserMap &userMap,
const std::string &user) {
53 auto it = userMap.find(user);
54 if (it != userMap.end())
55 return { it->second,
true };
56 return { user,
false };
Equality test for string and string_view to be used in containers.
Definition: String.h:281
Hash for string and string_view to be used in hashing containers.
Definition: String.h:254
std::unordered_set< std::string, SlHelpers::String::Hash, SlHelpers::String::Eq > UserSet
Set of users.
Definition: LDAP.h:19
const UserSet & userSet() const &
Get the set of users fetched from LDAP.
Definition: LDAP.h:31
Definition: Branches.h:15
bool contains(const std::string &key) const noexcept
Check if a user is in the set of users fetched from LDAP.
Definition: LDAP.h:37
UserSet userSet() &&
Get the set of users fetched from LDAP (rvalue).
Definition: LDAP.h:34
Class to fetch LDAP users.
Definition: LDAP.h:15