From 0b14c471fc77cbcb93f435a46878b25f57741e0e Mon Sep 17 00:00:00 2001 From: Tom Joseph Date: Sun, 30 Sep 2018 01:42:59 +0530 Subject: ldap: Add persistence for LDAP mapper D-Bus objects Change-Id: Ib8979a7c655f74c332d80e7fb221ef03e9a3f83c Signed-off-by: Tom Joseph --- phosphor-ldap-mapper/ldap_mapper_entry.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'phosphor-ldap-mapper/ldap_mapper_entry.cpp') diff --git a/phosphor-ldap-mapper/ldap_mapper_entry.cpp b/phosphor-ldap-mapper/ldap_mapper_entry.cpp index 64d3578..95f381d 100644 --- a/phosphor-ldap-mapper/ldap_mapper_entry.cpp +++ b/phosphor-ldap-mapper/ldap_mapper_entry.cpp @@ -7,6 +7,7 @@ #include "config.h" #include "ldap_mapper_entry.hpp" #include "ldap_mapper_mgr.hpp" +#include "ldap_mapper_serialize.hpp" namespace phosphor { @@ -31,6 +32,14 @@ LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus::bus &bus, const char *path, Ifaces::emit_object_added(); } +LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus::bus &bus, const char *path, + LDAPMapperMgr &parent) : + Ifaces(bus, path, true), + id(std::stol(std::experimental::filesystem::path(path).filename())), + manager(parent) +{ +} + void LDAPMapperEntry::delete_(void) { manager.deletePrivilegeMapper(id); @@ -44,7 +53,9 @@ std::string LDAPMapperEntry::groupName(std::string value) } manager.checkPrivilegeMapper(value); - return Ifaces::groupName(value); + auto val = Ifaces::groupName(value); + serialize(*this, id); + return val; } std::string LDAPMapperEntry::privilege(std::string value) @@ -55,7 +66,9 @@ std::string LDAPMapperEntry::privilege(std::string value) } manager.checkPrivilegeLevel(value); - return Ifaces::privilege(value); + auto val = Ifaces::privilege(value); + serialize(*this, id); + return val; } } // namespace user -- cgit v1.2.1