blob: 7d918d8912cb5928d74ccdeb39d49aa847187c82 [file] [log] [blame]
Tom Joseph0b14c472018-09-30 01:42:59 +05301#pragma once
2
Gunnar Mills703131f2020-10-28 14:26:33 -05003#include <filesystem>
Tom Josephf5bd8912018-11-19 09:49:21 +05304#include "config.h"
Tom Joseph0b14c472018-09-30 01:42:59 +05305#include "ldap_mapper_entry.hpp"
6
7namespace phosphor
8{
9namespace user
10{
11
Tom Joseph0b14c472018-09-30 01:42:59 +053012/** @brief Serialize and persist LDAP privilege mapper D-Bus object
13 *
14 * @param[in] entry - LDAP privilege mapper entry
15 * @param[in] id - filename of the persisted LDAP mapper entry
Tom Josephf5bd8912018-11-19 09:49:21 +053016 * @param[in] dir - pathname of directory where the serialized privilege
17 * mappings are stored.
Tom Joseph0b14c472018-09-30 01:42:59 +053018 *
Gunnar Mills703131f2020-10-28 14:26:33 -050019 * @return std::filesystem::path - pathname of persisted error file
Tom Joseph0b14c472018-09-30 01:42:59 +053020 */
Gunnar Mills703131f2020-10-28 14:26:33 -050021std::filesystem::path serialize(const LDAPMapperEntry& entry, Id id,
22 const std::filesystem::path& dir);
Tom Joseph0b14c472018-09-30 01:42:59 +053023
24/** @brief Deserialize a persisted LDAP privilege mapper into a D-Bus object
25 *
26 * @param[in] path - pathname of persisted file
27 * @param[in/out] entry - reference to LDAP privilege mapper entry object
28 * which is the target of deserialization.
29 *
30 * @return bool - true if the deserialization was successful, false otherwise.
31 */
Gunnar Mills703131f2020-10-28 14:26:33 -050032bool deserialize(const std::filesystem::path& path, LDAPMapperEntry& entry);
Tom Joseph0b14c472018-09-30 01:42:59 +053033
34} // namespace user
35} // namespace phosphor