Tom Joseph | 0b14c47 | 2018-09-30 01:42:59 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <experimental/filesystem> |
Tom Joseph | f5bd891 | 2018-11-19 09:49:21 +0530 | [diff] [blame] | 4 | #include "config.h" |
Tom Joseph | 0b14c47 | 2018-09-30 01:42:59 +0530 | [diff] [blame] | 5 | #include "ldap_mapper_entry.hpp" |
| 6 | |
| 7 | namespace phosphor |
| 8 | { |
| 9 | namespace user |
| 10 | { |
| 11 | |
| 12 | namespace fs = std::experimental::filesystem; |
| 13 | |
| 14 | /** @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 Joseph | f5bd891 | 2018-11-19 09:49:21 +0530 | [diff] [blame] | 18 | * @param[in] dir - pathname of directory where the serialized privilege |
| 19 | * mappings are stored. |
Tom Joseph | 0b14c47 | 2018-09-30 01:42:59 +0530 | [diff] [blame] | 20 | * |
| 21 | * @return fs::path - pathname of persisted error file |
| 22 | */ |
Tom Joseph | f5bd891 | 2018-11-19 09:49:21 +0530 | [diff] [blame] | 23 | fs::path serialize(const LDAPMapperEntry& entry, Id id, const fs::path& dir); |
Tom Joseph | 0b14c47 | 2018-09-30 01:42:59 +0530 | [diff] [blame] | 24 | |
| 25 | /** @brief Deserialize a persisted LDAP privilege mapper into a D-Bus object |
| 26 | * |
| 27 | * @param[in] path - pathname of persisted file |
| 28 | * @param[in/out] entry - reference to LDAP privilege mapper entry object |
| 29 | * which is the target of deserialization. |
| 30 | * |
| 31 | * @return bool - true if the deserialization was successful, false otherwise. |
| 32 | */ |
| 33 | bool deserialize(const fs::path& path, LDAPMapperEntry& entry); |
| 34 | |
| 35 | } // namespace user |
| 36 | } // namespace phosphor |