Copying the files from the mapper to the config
It was needed as in the next commit we would be
generating the ldap priv mapping object under the
ldap config object.
This is to align with the redfish.
https://redfish.dmtf.org/schemas/AccountService.v1_4_0.json
As per redfish, Each config will have it's own
"RemoteRoleMapping".
TestedBy: Unit-tested
All existing test cases gets passed.
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Change-Id: Ibec2c0b809ce15e71bd3ed84a2d0efdad24f1d17
diff --git a/phosphor-ldap-config/ldap_mapper_serialize.hpp b/phosphor-ldap-config/ldap_mapper_serialize.hpp
new file mode 100644
index 0000000..5ab71c0
--- /dev/null
+++ b/phosphor-ldap-config/ldap_mapper_serialize.hpp
@@ -0,0 +1,36 @@
+#pragma once
+
+#include <experimental/filesystem>
+#include "config.h"
+#include "ldap_mapper_entry.hpp"
+
+namespace phosphor
+{
+namespace user
+{
+
+namespace fs = std::experimental::filesystem;
+
+/** @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 fs::path - pathname of persisted error file
+ */
+fs::path serialize(const LDAPMapperEntry& entry, Id id, const fs::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 fs::path& path, LDAPMapperEntry& entry);
+
+} // namespace user
+} // namespace phosphor