7#include <unordered_map>
8#include <unordered_set>
10#include "../helpers/String.h"
30 LDAPUsers(
const std::string &dn,
const std::string &password);
39 bool contains(
const std::string &key)
const noexcept {
return m_userSet.contains(key); }
41 using UserMap = std::unordered_map<std::string, std::string>;
45 static void walkSection(UserMap &userMap,
const INIReader &reader,
46 const std::string §ion,
bool lognameIsKey);
47 static void addUserMapCond(UserMap &userMap, std::string &&logname, std::string &&email);
49 void buildSet(
const std::string &dn,
const std::string &password,
const UserMap &userMap);
51 std::pair<std::string_view, bool>
52 getMappedUser(
const UserMap &userMap,
const std::string &user)
const {
53 auto it = userMap.find(user);
54 if (it != userMap.end())
55 return { it->second,
true };
56 return { user,
false };
const UserSet & userSet() const &
Get the set of users fetched from LDAP.
Definition LDAP.h:33
UserSet userSet() &&
Get the set of users fetched from LDAP (rvalue).
Definition LDAP.h:36
LDAPUsers(const std::string &dn, const std::string &password)
Construct a new LDAPUsers object.
std::unordered_set< std::string, SlHelpers::String::Hash, SlHelpers::String::Eq > UserSet
Set of users.
Definition LDAP.h:20
bool contains(const std::string &key) const noexcept
Check if a user is in the set of users fetched from LDAP.
Definition LDAP.h:39
Equality test for string and string_view to be used in containers.
Definition String.h:258
Hash for string and string_view to be used in hashing containers.
Definition String.h:231