remove obsolete phosphor-ldap-mapper

`phosphor-ldap-config` now provides the full functionality of the role
mapper. `phosphor-ldap-mapper` is obsolete and makes confused.

This commit completely removes `phosphor-ldap-mapper`.

Change-Id: I3b62b06395861daa743530ad856fa1fa80b1d427
Signed-off-by: Alexander Filippov <a.filippov@yadro.com>
diff --git a/Makefile.am b/Makefile.am
index 1dbd594..7e6df6f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,7 +28,7 @@
 SYSTEM_UNIT_ALIASES = \
 	../phosphor-certificate-manager@.service multi-user.target.wants/phosphor-certificate-manager@nslcd.service
 
-SUBDIRS = . phosphor-ldap-mapper phosphor-ldap-config test
+SUBDIRS = . phosphor-ldap-config test
 
 install-aliases-hook:
 	set -- $(SYSTEM_UNIT_ALIASES) && \
diff --git a/configure.ac b/configure.ac
index 97e5321..d3f92f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,16 +20,6 @@
 AS_IF([test "x$USER_MANAGER_BUSNAME" == "x"], [USER_MANAGER_BUSNAME="xyz.openbmc_project.User.Manager"])
 AC_DEFINE_UNQUOTED([USER_MANAGER_BUSNAME], ["$USER_MANAGER_BUSNAME"], [The DBus busname to own])
 
-AC_ARG_VAR(LDAP_MAPPER_MANAGER_BUSNAME, [The Dbus busname LDAP privilege mapper application])
-AS_IF([test "x$LDAP_MAPPER_MANAGER_BUSNAME" == "x"], [LDAP_MAPPER_MANAGER_BUSNAME="xyz.openbmc_project.LDAP.PrivilegeMapper"])
-AC_DEFINE_UNQUOTED([LDAP_MAPPER_MANAGER_BUSNAME], ["$LDAP_MAPPER_MANAGER_BUSNAME"], [The Dbus busname LDAP privilege mapper application])
-
-AC_ARG_VAR(LDAP_MAPPER_PERSIST_PATH, [Path of directory containing LDAP groups privilege mapping])
-AS_IF([test "x$LDAP_MAPPER_PERSIST_PATH" == "x"], \
-    [LDAP_MAPPER_PERSIST_PATH="/var/lib/phosphor-ldap-mapper/groups"])
-AC_DEFINE_UNQUOTED([LDAP_MAPPER_PERSIST_PATH], ["$LDAP_MAPPER_PERSIST_PATH"], \
-    [Path of directory containing LDAP groups privilege mapping])
-
 AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal])
 AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1])
 AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal])
@@ -142,5 +132,5 @@
 LT_INIT
 
 # Create configured output
-AC_CONFIG_FILES([Makefile test/Makefile phosphor-ldap-mapper/Makefile phosphor-ldap-config/Makefile])
+AC_CONFIG_FILES([Makefile test/Makefile phosphor-ldap-config/Makefile])
 AC_OUTPUT
diff --git a/meson.build b/meson.build
index 7cb6227..d90ab95 100644
--- a/meson.build
+++ b/meson.build
@@ -14,12 +14,6 @@
 conf_data.set_quoted('USER_MANAGER_BUSNAME', 'xyz.openbmc_project.User.Manager',
                       description : 'The DBus busname to own.')
 
-conf_data.set_quoted('LDAP_MAPPER_MANAGER_BUSNAME', 'xyz.openbmc_project.LDAP.PrivilegeMapper',
-                      description : 'The Dbus busname LDAP privilege mapper application.')
-
-conf_data.set_quoted('LDAP_MAPPER_PERSIST_PATH', '/var/lib/phosphor-ldap-mapper/groups',
-                      description : 'Path of directory containing LDAP groups privilege mapping.')
-
 conf_data.set_quoted('DEFAULT_CRYPT_ALGO', '1',
                       description : 'The default crypt algorithm if one not found in shadow.')
 
@@ -173,7 +167,6 @@
     )
 endforeach
 
-subdir('phosphor-ldap-mapper')
 subdir('phosphor-ldap-config')
 
 if get_option('tests').enabled()
diff --git a/phosphor-ldap-mapper/Makefile.am b/phosphor-ldap-mapper/Makefile.am
deleted file mode 100644
index 7bd58d5..0000000
--- a/phosphor-ldap-mapper/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-bin_PROGRAMS = phosphor-ldap-mapper
-
-noinst_HEADERS = ldap_mapper_mgr.hpp \
-                 ldap_mapper_entry.hpp \
-                 ldap_mapper_serialize.hpp
-
-phosphor_ldap_mapper_SOURCES = \
-                main.cpp \
-                ldap_mapper_mgr.cpp \
-                ldap_mapper_entry.cpp \
-                ldap_mapper_serialize.cpp
-
-phosphor_ldap_mapper_LDFLAGS = $(SDBUSPLUS_LIBS) \
-                               $(PHOSPHOR_DBUS_INTERFACES_LIBS) \
-                               $(PHOSPHOR_LOGGING_LIBS)
-
-phosphor_ldap_mapper_CXXFLAGS = $(SYSTEMD_CFLAGS) \
-                                $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
-                                $(PHOSPHOR_LOGGING_CFLAGS) \
-                                -flto
diff --git a/phosphor-ldap-mapper/ldap_mapper_entry.cpp b/phosphor-ldap-mapper/ldap_mapper_entry.cpp
deleted file mode 100644
index 01f8f41..0000000
--- a/phosphor-ldap-mapper/ldap_mapper_entry.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "config.h"
-
-#include "ldap_mapper_entry.hpp"
-
-#include "ldap_mapper_mgr.hpp"
-#include "ldap_mapper_serialize.hpp"
-
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
-#include <xyz/openbmc_project/User/Common/error.hpp>
-
-#include <filesystem>
-
-namespace phosphor
-{
-namespace user
-{
-
-using namespace phosphor::logging;
-using InvalidArgument =
-    sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument;
-using Argument = xyz::openbmc_project::Common::InvalidArgument;
-
-LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus::bus& bus, const char* path,
-                                 const char* filePath,
-                                 const std::string& groupName,
-                                 const std::string& privilege,
-                                 LDAPMapperMgr& parent) :
-    Ifaces(bus, path, Ifaces::action::defer_emit),
-    id(std::stol(std::filesystem::path(path).filename())), manager(parent),
-    persistPath(filePath)
-{
-    Ifaces::privilege(privilege, true);
-    Ifaces::groupName(groupName, true);
-    Ifaces::emit_object_added();
-}
-
-LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus::bus& bus, const char* path,
-                                 const char* filePath, LDAPMapperMgr& parent) :
-    Ifaces(bus, path, Ifaces::action::defer_emit),
-    id(std::stol(std::filesystem::path(path).filename())), manager(parent),
-    persistPath(filePath)
-{}
-
-void LDAPMapperEntry::delete_(void)
-{
-    manager.deletePrivilegeMapper(id);
-}
-
-std::string LDAPMapperEntry::groupName(std::string value)
-{
-    if (value == Ifaces::groupName())
-    {
-        return value;
-    }
-
-    manager.checkPrivilegeMapper(value);
-    auto val = Ifaces::groupName(value);
-    serialize(*this, id, persistPath);
-    return val;
-}
-
-std::string LDAPMapperEntry::privilege(std::string value)
-{
-    if (value == Ifaces::privilege())
-    {
-        return value;
-    }
-
-    manager.checkPrivilegeLevel(value);
-    auto val = Ifaces::privilege(value);
-    serialize(*this, id, persistPath);
-    return val;
-}
-
-} // namespace user
-} // namespace phosphor
diff --git a/phosphor-ldap-mapper/ldap_mapper_entry.hpp b/phosphor-ldap-mapper/ldap_mapper_entry.hpp
deleted file mode 100644
index bb45aa3..0000000
--- a/phosphor-ldap-mapper/ldap_mapper_entry.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-#pragma once
-
-#include <sdbusplus/bus.hpp>
-#include <sdbusplus/server/object.hpp>
-#include <xyz/openbmc_project/Object/Delete/server.hpp>
-#include <xyz/openbmc_project/User/PrivilegeMapperEntry/server.hpp>
-
-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<Entry, Delete>;
-
-// 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] filePath - serialization directory path
-     *  @param[in] groupName - LDAP group name
-     *  @param[in] privilege - the privilege for the group
-     *  @param[in] parent - LDAP privilege mapper manager
-     */
-    LDAPMapperEntry(sdbusplus::bus::bus& bus, const char* path,
-                    const char* filePath, const std::string& groupName,
-                    const std::string& privilege, LDAPMapperMgr& parent);
-
-    /** @brief Constructs LDAP privilege mapper entry object
-     *
-     *  @param[in] bus  - sdbusplus handler
-     *  @param[in] path - D-Bus path
-     *  @param[in] filePath - serialization directory path
-     *  @param[in] parent - LDAP privilege mapper manager
-     */
-    LDAPMapperEntry(sdbusplus::bus::bus& bus, const char* path,
-                    const char* filePath, 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;
-
-    /** @brief serialization directory path */
-    std::string persistPath;
-};
-
-} // namespace user
-} // namespace phosphor
diff --git a/phosphor-ldap-mapper/ldap_mapper_mgr.cpp b/phosphor-ldap-mapper/ldap_mapper_mgr.cpp
deleted file mode 100644
index 3a383f6..0000000
--- a/phosphor-ldap-mapper/ldap_mapper_mgr.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-#include "config.h"
-
-#include "ldap_mapper_mgr.hpp"
-
-#include "ldap_mapper_serialize.hpp"
-
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
-#include <xyz/openbmc_project/User/Common/error.hpp>
-
-#include <filesystem>
-
-namespace phosphor
-{
-namespace user
-{
-
-using namespace phosphor::logging;
-using InvalidArgument =
-    sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument;
-using Argument = xyz::openbmc_project::Common::InvalidArgument;
-using PrivilegeMappingExists = sdbusplus::xyz::openbmc_project::User::Common::
-    Error::PrivilegeMappingExists;
-
-LDAPMapperMgr::LDAPMapperMgr(sdbusplus::bus::bus& bus, const char* path,
-                             const char* filePath) :
-    MapperMgrIface(bus, path),
-    bus(bus), path(path), persistPath(filePath)
-{}
-
-ObjectPath LDAPMapperMgr::create(std::string groupName, std::string privilege)
-{
-    checkPrivilegeMapper(groupName);
-    checkPrivilegeLevel(privilege);
-
-    entryId++;
-
-    // Object path for the LDAP group privilege mapper entry
-    auto mapperObject =
-        std::string(mapperMgrRoot) + "/" + std::to_string(entryId);
-
-    // Create mapping for LDAP privilege mapper entry
-    auto entry = std::make_unique<phosphor::user::LDAPMapperEntry>(
-        bus, mapperObject.c_str(), persistPath.c_str(), groupName, privilege,
-        *this);
-
-    serialize(*entry, entryId, persistPath);
-
-    PrivilegeMapperList.emplace(entryId, std::move(entry));
-
-    return mapperObject;
-}
-
-void LDAPMapperMgr::deletePrivilegeMapper(Id id)
-{
-    // Delete the persistent representation of the privilege mapper.
-    std::filesystem::path mapperPath(persistPath);
-    mapperPath /= std::to_string(id);
-    std::filesystem::remove(mapperPath);
-
-    PrivilegeMapperList.erase(id);
-}
-
-void LDAPMapperMgr::checkPrivilegeMapper(const std::string& groupName)
-{
-    if (groupName.empty())
-    {
-        log<level::ERR>("Group name is empty");
-        elog<InvalidArgument>(Argument::ARGUMENT_NAME("Group name"),
-                              Argument::ARGUMENT_VALUE("Null"));
-    }
-
-    for (const auto& val : PrivilegeMapperList)
-    {
-        if (val.second.get()->groupName() == groupName)
-        {
-            log<level::ERR>("Group name already exists");
-            elog<PrivilegeMappingExists>();
-        }
-    }
-}
-
-void LDAPMapperMgr::checkPrivilegeLevel(const std::string& privilege)
-{
-    if (privilege.empty())
-    {
-        log<level::ERR>("Privilege level is empty");
-        elog<InvalidArgument>(Argument::ARGUMENT_NAME("Privilege level"),
-                              Argument::ARGUMENT_VALUE("Null"));
-    }
-
-    if (std::find(privMgr.begin(), privMgr.end(), privilege) == privMgr.end())
-    {
-        log<level::ERR>("Invalid privilege");
-        elog<InvalidArgument>(Argument::ARGUMENT_NAME("Privilege level"),
-                              Argument::ARGUMENT_VALUE(privilege.c_str()));
-    }
-}
-
-void LDAPMapperMgr::restore()
-{
-    std::filesystem::path dir(persistPath);
-    if (!std::filesystem::exists(dir) || std::filesystem::is_empty(dir))
-    {
-        return;
-    }
-
-    for (auto& file : std::filesystem::directory_iterator(dir))
-    {
-        std::string id = file.path().filename().c_str();
-        size_t idNum = std::stol(id);
-        auto entryPath = std::string(mapperMgrRoot) + '/' + id;
-        auto entry = std::make_unique<phosphor::user::LDAPMapperEntry>(
-            bus, entryPath.c_str(), persistPath.c_str(), *this);
-        if (deserialize(file.path(), *entry))
-        {
-            entry->Ifaces::emit_object_added();
-            PrivilegeMapperList.emplace(idNum, std::move(entry));
-            if (idNum > entryId)
-            {
-                entryId = idNum;
-            }
-        }
-    }
-}
-
-} // namespace user
-} // namespace phosphor
diff --git a/phosphor-ldap-mapper/ldap_mapper_mgr.hpp b/phosphor-ldap-mapper/ldap_mapper_mgr.hpp
deleted file mode 100644
index 3792f0a..0000000
--- a/phosphor-ldap-mapper/ldap_mapper_mgr.hpp
+++ /dev/null
@@ -1,119 +0,0 @@
-#pragma once
-
-#include "ldap_mapper_entry.hpp"
-
-#include <sdbusplus/bus.hpp>
-#include <sdbusplus/server/object.hpp>
-#include <xyz/openbmc_project/User/PrivilegeMapper/server.hpp>
-
-#include <map>
-#include <set>
-
-namespace phosphor
-{
-
-namespace user
-{
-
-using MapperMgrIface =
-    sdbusplus::xyz::openbmc_project::User::server::PrivilegeMapper;
-using ObjectPath = sdbusplus::message::object_path;
-
-// D-Bus root for LDAP privilege mapper
-constexpr auto mapperMgrRoot = "/xyz/openbmc_project/user/ldap";
-
-/** @class LDAPMapperMgr
- *
- *  @brief Responsible for managing LDAP groups to privilege mapping.
- */
-class LDAPMapperMgr : public MapperMgrIface
-{
-  public:
-    LDAPMapperMgr() = delete;
-    ~LDAPMapperMgr() = default;
-    LDAPMapperMgr(const LDAPMapperMgr&) = delete;
-    LDAPMapperMgr& operator=(const LDAPMapperMgr&) = delete;
-    LDAPMapperMgr(LDAPMapperMgr&&) = delete;
-    LDAPMapperMgr& operator=(LDAPMapperMgr&&) = delete;
-
-    /** @brief Constructs LDAPMapperMgr object.
-     *
-     *  @param[in] bus  - sdbusplus handler
-     *  @param[in] path - D-Bus path
-     *  @param[in] filePath - serialization directory path
-     */
-    LDAPMapperMgr(sdbusplus::bus::bus& bus, const char* path,
-                  const char* filePath);
-
-    /** @brief Creates a mapping for the group to the privilege
-     *
-     *  @param[in] groupName - Group Name to which the privilege needs to be
-     *                         assigned.
-     *  @param[in] privilege - The privilege role associated with the group.
-     *
-     *  @return On success return the D-Bus object path of the created privilege
-     *          mapper entry.
-     */
-    ObjectPath create(std::string groupName, std::string privilege) override;
-
-    /** @brief Delete privilege mapping for LDAP group
-     *
-     *  This method deletes the privilege mapping
-     *
-     *  @param[in] groupName - name of the LDAP group for which privilege
-     *                         mapping is to be deleted.
-     */
-    void deletePrivilegeMapper(Id id);
-
-    /** @brief Check if LDAP group privilege mapping requested is valid
-     *
-     *  Check if the privilege mapping already exists for the LDAP group name
-     *  and group name is empty.
-     *
-     *  @param[in] groupName - LDAP group name
-     *
-     *  @return throw exception if the conditions are not met.
-     */
-    void checkPrivilegeMapper(const std::string& groupName);
-
-    /** @brief Check if the privilege level is a valid one
-     *
-     *  @param[in] privilege - Privilege level
-     *
-     *  @return throw exception if the conditions are not met.
-     */
-    void checkPrivilegeLevel(const std::string& privilege);
-
-    /** @brief Construct LDAP mapper entry D-Bus objects from their persisted
-     *         representations.
-     */
-    void restore();
-
-  private:
-    /** @brief sdbusplus handler */
-    sdbusplus::bus::bus& bus;
-
-    /** @brief object path for the manager object*/
-    const std::string path;
-
-    /** @brief serialization directory path */
-    std::string persistPath;
-
-    /** @brief available privileges container */
-    std::set<std::string> privMgr = {
-        "priv-admin",
-        "priv-operator",
-        "priv-user",
-        "priv-noaccess",
-    };
-
-    /** @brief Id of the last privilege mapper entry */
-    Id entryId = 0;
-
-    /** @brief container to hold privilege mapper objects */
-    std::map<Id, std::unique_ptr<phosphor::user::LDAPMapperEntry>>
-        PrivilegeMapperList;
-};
-
-} // namespace user
-} // namespace phosphor
diff --git a/phosphor-ldap-mapper/ldap_mapper_serialize.cpp b/phosphor-ldap-mapper/ldap_mapper_serialize.cpp
deleted file mode 100644
index c167a69..0000000
--- a/phosphor-ldap-mapper/ldap_mapper_serialize.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "config.h"
-
-#include "ldap_mapper_serialize.hpp"
-
-#include <cereal/archives/binary.hpp>
-#include <cereal/types/string.hpp>
-#include <phosphor-logging/log.hpp>
-
-#include <filesystem>
-#include <fstream>
-
-// Register class version
-// From cereal documentation;
-// "This macro should be placed at global scope"
-CEREAL_CLASS_VERSION(phosphor::user::LDAPMapperEntry, CLASS_VERSION);
-
-namespace phosphor
-{
-namespace user
-{
-
-using namespace phosphor::logging;
-
-/** @brief Function required by Cereal to perform serialization.
- *
- *  @tparam Archive - Cereal archive type (binary in this case).
- *  @param[in] archive - reference to cereal archive.
- *  @param[in] entry- const reference to LDAP mapper entry
- *  @param[in] version - Class version that enables handling a serialized data
- *                       across code levels
- */
-template <class Archive>
-void save(Archive& archive, const LDAPMapperEntry& entry,
-          const std::uint32_t /*version*/)
-{
-    archive(entry.groupName(), entry.privilege());
-}
-
-/** @brief Function required by Cereal to perform deserialization.
- *
- *  @tparam Archive - Cereal archive type (binary in our case).
- *  @param[in] archive - reference to cereal archive.
- *  @param[out] entry - LDAP mapper entry to be read
- *  @param[in] version - Class version that enables handling a serialized data
- *                       across code levels
- */
-template <class Archive>
-void load(Archive& archive, LDAPMapperEntry& entry,
-          const std::uint32_t /*version*/)
-{
-    std::string groupName{};
-    std::string privilege{};
-
-    archive(groupName, privilege);
-
-    entry.sdbusplus::xyz::openbmc_project::User::server::PrivilegeMapperEntry::
-        groupName(groupName, true);
-    entry.sdbusplus::xyz::openbmc_project::User::server::PrivilegeMapperEntry::
-        privilege(privilege, true);
-}
-
-std::filesystem::path serialize(const LDAPMapperEntry& entry, Id id,
-                                const std::filesystem::path& dir)
-{
-    auto path = dir / std::to_string(id);
-    std::ofstream os(path.c_str(), std::ios::binary);
-    cereal::BinaryOutputArchive oarchive(os);
-    oarchive(entry);
-    return path;
-}
-
-bool deserialize(const std::filesystem::path& path, LDAPMapperEntry& entry)
-{
-    try
-    {
-        if (std::filesystem::exists(path))
-        {
-            std::ifstream is(path.c_str(), std::ios::in | std::ios::binary);
-            cereal::BinaryInputArchive iarchive(is);
-            iarchive(entry);
-            return true;
-        }
-        return false;
-    }
-    catch (const cereal::Exception& e)
-    {
-        log<level::ERR>(e.what());
-        std::filesystem::remove(path);
-        return false;
-    }
-    catch (const std::length_error& e)
-    {
-        log<level::ERR>(e.what());
-        std::filesystem::remove(path);
-        return false;
-    }
-}
-
-} // namespace user
-} // namespace phosphor
diff --git a/phosphor-ldap-mapper/ldap_mapper_serialize.hpp b/phosphor-ldap-mapper/ldap_mapper_serialize.hpp
deleted file mode 100644
index f306ada..0000000
--- a/phosphor-ldap-mapper/ldap_mapper_serialize.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-
-#include "config.h"
-
-#include "ldap_mapper_entry.hpp"
-
-#include <filesystem>
-
-namespace phosphor
-{
-namespace user
-{
-
-/** @brief Serialize and persist LDAP privilege mapper D-Bus object
- *
- *  @param[in] entry - LDAP privilege mapper entry
- *  @param[in] id - filename of the persisted LDAP mapper entry
- *  @param[in] dir - pathname of directory where the serialized privilege
- *                   mappings are stored.
- *
- *  @return std::filesystem::path - pathname of persisted error file
- */
-std::filesystem::path serialize(const LDAPMapperEntry& entry, Id id,
-                                const std::filesystem::path& dir);
-
-/** @brief Deserialize a persisted LDAP privilege mapper into a D-Bus object
- *
- *  @param[in] path - pathname of persisted file
- *  @param[in/out] entry - reference to  LDAP privilege mapper entry object
- *                         which is the target of deserialization.
- *
- *  @return bool - true if the deserialization was successful, false otherwise.
- */
-bool deserialize(const std::filesystem::path& path, LDAPMapperEntry& entry);
-
-} // namespace user
-} // namespace phosphor
diff --git a/phosphor-ldap-mapper/main.cpp b/phosphor-ldap-mapper/main.cpp
deleted file mode 100644
index 60109d4..0000000
--- a/phosphor-ldap-mapper/main.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "config.h"
-
-#include "ldap_mapper_mgr.hpp"
-
-#include <filesystem>
-#include <string>
-
-int main(int /*argc*/, char** /*argv*/)
-{
-    auto bus = sdbusplus::bus::new_default();
-    sdbusplus::server::manager::manager objManager(
-        bus, phosphor::user::mapperMgrRoot);
-
-    phosphor::user::LDAPMapperMgr mapperMgr(bus, phosphor::user::mapperMgrRoot,
-                                            LDAP_MAPPER_PERSIST_PATH);
-
-    // Create a directory to persist errors.
-    std::filesystem::create_directories(LDAP_MAPPER_PERSIST_PATH);
-
-    // Restore the serialized LDAP group privilege mapping.
-    mapperMgr.restore();
-
-    // Claim the bus name for the application
-    bus.request_name(LDAP_MAPPER_MANAGER_BUSNAME);
-
-    // Wait for client request
-    while (true)
-    {
-        // Process D-Bus calls
-        bus.process_discard();
-        bus.wait();
-    }
-    return 0;
-}
diff --git a/phosphor-ldap-mapper/meson.build b/phosphor-ldap-mapper/meson.build
deleted file mode 100644
index a3a027e..0000000
--- a/phosphor-ldap-mapper/meson.build
+++ /dev/null
@@ -1,31 +0,0 @@
-phosphor_ldap_mapper_deps = [
-    cereal_dep,
-    phosphor_dbus_interfaces_dep,
-    phosphor_logging_dep,
-    sdbusplus_dep,
-]
-
-phosphor_ldap_mapper_lib = static_library(
-    'phosphor_ldap_mapper',
-    [
-        'ldap_mapper_mgr.cpp',
-        'ldap_mapper_entry.cpp',
-        'ldap_mapper_serialize.cpp'
-    ],
-    include_directories: '..',
-    dependencies: phosphor_ldap_mapper_deps,
-)
-
-phosphor_ldap_mapper_dep = declare_dependency(
-    link_with: phosphor_ldap_mapper_lib,
-    dependencies: phosphor_ldap_mapper_deps,
-)
-
-executable(
-    'phosphor-ldap-mapper',
-    'main.cpp',
-    include_directories: '..',
-    dependencies: phosphor_ldap_mapper_dep,
-    install: true,
-)
-
diff --git a/test/Makefile.am b/test/Makefile.am
index 03c918e..52ad53a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -33,16 +33,6 @@
                           $(top_builddir)/phosphor-ldap-config/ldap_mapper_entry.o \
                           $(top_builddir)/phosphor-ldap-config/ldap_mapper_serialize.o
 
-check_PROGRAMS += ldap_mapper_test
-ldap_mapper_test_CPPFLAGS = $(cppflags)
-ldap_mapper_test_CXXFLAGS = $(cxxflags)
-ldap_mapper_test_LDFLAGS  = $(ldflags) \
-                            -lgmock
-ldap_mapper_test_SOURCES  = ldap_mapper_test.cpp
-ldap_mapper_test_LDADD  = $(top_builddir)/phosphor-ldap-mapper/ldap_mapper_entry.o \
-                          $(top_builddir)/phosphor-ldap-mapper/ldap_mapper_mgr.o \
-                          $(top_builddir)/phosphor-ldap-mapper/ldap_mapper_serialize.o
-
 check_PROGRAMS += user_mgr_test
 user_mgr_test_CPPFLAGS = $(cppflags)
 user_mgr_test_CXXFLAGS = $(cxxflags) $(GTEST_CPPFLAGS)
diff --git a/test/ldap_mapper_test.cpp b/test/ldap_mapper_test.cpp
deleted file mode 100644
index 275ebe5..0000000
--- a/test/ldap_mapper_test.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-#include "config.h"
-
-#include "phosphor-ldap-mapper/ldap_mapper_entry.hpp"
-#include "phosphor-ldap-mapper/ldap_mapper_mgr.hpp"
-#include "phosphor-ldap-mapper/ldap_mapper_serialize.hpp"
-
-#include <stdlib.h>
-
-#include <sdbusplus/bus.hpp>
-#include <sdbusplus/test/sdbus_mock.hpp>
-#include <xyz/openbmc_project/Common/error.hpp>
-#include <xyz/openbmc_project/User/Common/error.hpp>
-
-#include <filesystem>
-
-#include <gtest/gtest.h>
-
-namespace phosphor
-{
-namespace user
-{
-
-class TestSerialization : public testing::Test
-{
-  public:
-    sdbusplus::SdBusMock sdbusMock;
-
-    TestSerialization() : bus(sdbusplus::get_mocked_new(&sdbusMock))
-    {}
-
-    void SetUp() override
-    {
-        char tempDir[] = "/tmp/privmapper_test.XXXXXX";
-        dir = std::filesystem::path(mkdtemp(tempDir));
-    }
-
-    void TearDown() override
-    {
-        std::filesystem::remove_all(dir);
-    }
-
-    std::filesystem::path dir;
-    sdbusplus::bus::bus bus;
-};
-
-TEST_F(TestSerialization, testPersistPath)
-{
-    LDAPMapperMgr manager(TestSerialization::bus, mapperMgrRoot,
-                          TestSerialization::dir.c_str());
-    std::string groupName = "admin";
-    std::string privilege = "priv-admin";
-    size_t entryId = 1;
-    auto dbusPath = std::string(mapperMgrRoot) + '/' + std::to_string(entryId);
-
-    auto entry = std::make_unique<LDAPMapperEntry>(
-        TestSerialization::bus, dbusPath.c_str(),
-        (TestSerialization::dir).c_str(), groupName, privilege, manager);
-    auto outPath = serialize(*entry, entryId, TestSerialization::dir);
-    EXPECT_EQ(outPath, TestSerialization::dir / std::to_string(entryId));
-}
-
-TEST_F(TestSerialization, testPersistData)
-{
-    std::string groupName = "admin";
-    std::string privilege = "priv-admin";
-    size_t entryId = 1;
-    auto dbusPath = std::string(mapperMgrRoot) + '/' + std::to_string(entryId);
-    LDAPMapperMgr manager(TestSerialization::bus, mapperMgrRoot,
-                          TestSerialization::dir.c_str());
-
-    auto input = std::make_unique<LDAPMapperEntry>(
-        bus, dbusPath.c_str(), TestSerialization::dir.c_str(), groupName,
-        privilege, manager);
-    auto outPath = serialize(*input, entryId, TestSerialization::dir);
-
-    auto output = std::make_unique<LDAPMapperEntry>(
-        bus, dbusPath.c_str(), (TestSerialization::dir).c_str(), manager);
-    auto rc = deserialize(outPath, *output);
-
-    EXPECT_EQ(rc, true);
-    EXPECT_EQ(output->groupName(), groupName);
-    EXPECT_EQ(output->privilege(), privilege);
-}
-
-TEST_F(TestSerialization, testRestore)
-{
-    std::string groupName = "admin";
-    std::string privilege = "priv-admin";
-    size_t entryId = 1;
-    LDAPMapperMgr manager1(TestSerialization::bus, mapperMgrRoot,
-                           (TestSerialization::dir).c_str());
-    EXPECT_NO_THROW(manager1.create(groupName, privilege));
-
-    EXPECT_EQ(std::filesystem::exists(TestSerialization::dir /
-                                      std::to_string(entryId)),
-              true);
-    LDAPMapperMgr manager2(TestSerialization::bus, mapperMgrRoot,
-                           (TestSerialization::dir).c_str());
-    EXPECT_NO_THROW(manager2.restore());
-    EXPECT_NO_THROW(manager2.deletePrivilegeMapper(entryId));
-    EXPECT_EQ(std::filesystem::exists(TestSerialization::dir /
-                                      std::to_string(entryId)),
-              false);
-}
-
-TEST_F(TestSerialization, testPrivilegeMapperCreation)
-{
-    std::string groupName = "admin";
-    std::string privilege = "priv-admin";
-    LDAPMapperMgr manager(TestSerialization::bus, mapperMgrRoot,
-                          (TestSerialization::dir).c_str());
-    EXPECT_NO_THROW(manager.create(groupName, privilege));
-}
-
-TEST_F(TestSerialization, testDuplicateGroupName)
-{
-    std::string groupName = "admin";
-    std::string privilege = "priv-admin";
-    using PrivilegeMappingExists = sdbusplus::xyz::openbmc_project::User::
-        Common::Error::PrivilegeMappingExists;
-    LDAPMapperMgr manager(TestSerialization::bus, mapperMgrRoot,
-                          (TestSerialization::dir).c_str());
-    auto objectPath = manager.create(groupName, privilege);
-    EXPECT_THROW(manager.create(groupName, privilege), PrivilegeMappingExists);
-}
-
-TEST_F(TestSerialization, testValidPrivilege)
-{
-    std::string groupName = "admin";
-    std::string privilege = "priv-admin";
-    size_t entryId = 1;
-    auto dbusPath = std::string(mapperMgrRoot) + '/' + std::to_string(entryId);
-    LDAPMapperMgr manager(TestSerialization::bus, mapperMgrRoot,
-                          TestSerialization::dir.c_str());
-
-    auto entry = std::make_unique<LDAPMapperEntry>(
-        TestSerialization::bus, dbusPath.c_str(),
-        (TestSerialization::dir).c_str(), groupName, privilege, manager);
-
-    EXPECT_NO_THROW(entry->privilege("priv-operator"));
-    EXPECT_NO_THROW(entry->privilege("priv-user"));
-}
-
-TEST_F(TestSerialization, testInvalidPrivilege)
-{
-    std::string groupName = "admin";
-    std::string privilege = "priv-test";
-    using InvalidArgument =
-        sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument;
-    LDAPMapperMgr manager(TestSerialization::bus, mapperMgrRoot,
-                          (TestSerialization::dir).c_str());
-    EXPECT_THROW(manager.create(groupName, privilege), InvalidArgument);
-}
-
-} // namespace user
-} // namespace phosphor
diff --git a/test/meson.build b/test/meson.build
index 4dfad2e..f1d7af8 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -36,20 +36,6 @@
 )
 
 test(
-    'ldap_mapper_test',
-    executable(
-        'ldap_mapper_test',
-        'ldap_mapper_test.cpp',
-        include_directories: '..',
-        dependencies: [
-            gtest_dep,
-            gmock_dep,
-            phosphor_ldap_mapper_dep,
-        ],
-    ),
-)
-
-test(
     'user_mgr_test',
     executable(
         'user_mgr_test',