From 536ea32ddc61bc3f5ad34eada5788797e1771832 Mon Sep 17 00:00:00 2001 From: Tom Joseph Date: Fri, 14 Sep 2018 10:02:20 +0530 Subject: ldap: Add application to configure privilege for LDAP groups The application implements the xyz.openbmc_project.User.PrivilegeMapper D-Bus interface to configure privilege levels for LDAP groups. The Create method is used to create privilege mapping for the LDAP group. D-Bus object is created for each LDAP group and implements the D-Bus interface xyz.openbmc_project.User.PrivilegeMapperEntry. : Change-Id: I20935229a8a79ce1e52a857672a6a0085cb5ace4 Signed-off-by: Tom Joseph --- phosphor-ldap-mapper/ldap_mapper_entry.hpp | 83 ++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 phosphor-ldap-mapper/ldap_mapper_entry.hpp (limited to 'phosphor-ldap-mapper/ldap_mapper_entry.hpp') diff --git a/phosphor-ldap-mapper/ldap_mapper_entry.hpp b/phosphor-ldap-mapper/ldap_mapper_entry.hpp new file mode 100644 index 0000000..689639d --- /dev/null +++ b/phosphor-ldap-mapper/ldap_mapper_entry.hpp @@ -0,0 +1,83 @@ +#pragma once + +#include +#include +#include +#include + +namespace phosphor +{ +namespace user +{ + +namespace Base = sdbusplus::xyz::openbmc_project; +using Entry = + sdbusplus::xyz::openbmc_project::User::server::PrivilegeMapperEntry; +using Delete = sdbusplus::xyz::openbmc_project::Object::server::Delete; +using Ifaces = sdbusplus::server::object::object; + +// Forward declaration for LDAPMapperMgr +class LDAPMapperMgr; + +using Id = size_t; + +/** @class LDAPMapperEntry + * + * @brief This D-Bus object represents the privilege level for the LDAP group. + */ +class LDAPMapperEntry : public Ifaces +{ + public: + LDAPMapperEntry() = delete; + ~LDAPMapperEntry() = default; + LDAPMapperEntry(const LDAPMapperEntry &) = delete; + LDAPMapperEntry &operator=(const LDAPMapperEntry &) = delete; + LDAPMapperEntry(LDAPMapperEntry &&) = default; + LDAPMapperEntry &operator=(LDAPMapperEntry &&) = default; + + /** @brief Constructs LDAP privilege mapper entry object. + * + * @param[in] bus - sdbusplus handler + * @param[in] path - D-Bus path + * @param[in] privilege - the privilege for the group + * @param[in] parent - LDAP privilege mapper manager + */ + LDAPMapperEntry(sdbusplus::bus::bus &bus, const char *path, + const std::string &groupName, const std::string &privilege, + LDAPMapperMgr &parent); + + /** @brief Delete privilege mapper entry object + * + * This method deletes the privilege mapper entry. + */ + void delete_(void) override; + + /** @brief Update the group name of the mapper object + * + * @param[in] value - group name + * + * @return On success the updated group name + */ + std::string groupName(std::string value) override; + + /** @brief Update privilege associated with LDAP group + * + * @param[in] value - privilege level + * + * @return On success the updated privilege level + */ + std::string privilege(std::string value) override; + + using sdbusplus::xyz::openbmc_project::User::server::PrivilegeMapperEntry:: + privilege; + + using sdbusplus::xyz::openbmc_project::User::server::PrivilegeMapperEntry:: + groupName; + + private: + Id id; + LDAPMapperMgr &manager; +}; + +} // namespace user +} // namespace phosphor -- cgit v1.2.1