blob: f306ada42b44dd1b2b24406efa96961038b10e87 [file] [log] [blame]
Tom Joseph0b14c472018-09-30 01:42:59 +05301#pragma once
2
Tom Josephf5bd8912018-11-19 09:49:21 +05303#include "config.h"
Patrick Williams9638afb2021-02-22 17:16:24 -06004
Tom Joseph0b14c472018-09-30 01:42:59 +05305#include "ldap_mapper_entry.hpp"
6
Patrick Williams9638afb2021-02-22 17:16:24 -06007#include <filesystem>
8
Tom Joseph0b14c472018-09-30 01:42:59 +05309namespace phosphor
10{
11namespace user
12{
13
Tom Joseph0b14c472018-09-30 01:42:59 +053014/** @brief Serialize and persist LDAP privilege mapper D-Bus object
15 *
16 * @param[in] entry - LDAP privilege mapper entry
17 * @param[in] id - filename of the persisted LDAP mapper entry
Tom Josephf5bd8912018-11-19 09:49:21 +053018 * @param[in] dir - pathname of directory where the serialized privilege
19 * mappings are stored.
Tom Joseph0b14c472018-09-30 01:42:59 +053020 *
Gunnar Mills703131f2020-10-28 14:26:33 -050021 * @return std::filesystem::path - pathname of persisted error file
Tom Joseph0b14c472018-09-30 01:42:59 +053022 */
Gunnar Mills703131f2020-10-28 14:26:33 -050023std::filesystem::path serialize(const LDAPMapperEntry& entry, Id id,
24 const std::filesystem::path& dir);
Tom Joseph0b14c472018-09-30 01:42:59 +053025
26/** @brief Deserialize a persisted LDAP privilege mapper into a D-Bus object
27 *
28 * @param[in] path - pathname of persisted file
29 * @param[in/out] entry - reference to LDAP privilege mapper entry object
30 * which is the target of deserialization.
31 *
32 * @return bool - true if the deserialization was successful, false otherwise.
33 */
Gunnar Mills703131f2020-10-28 14:26:33 -050034bool deserialize(const std::filesystem::path& path, LDAPMapperEntry& entry);
Tom Joseph0b14c472018-09-30 01:42:59 +053035
36} // namespace user
37} // namespace phosphor