Fix RemoteRoleMap PATCH operation
RemoteRoleMap "LocalRole" property update fails since there was
conversion missing from redfish privilege to D-bus values
Looks like this commit dropped this change
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/64325/
This commit fixes this issue
Tested by:
Verified patch operation on RemoteRoleMap
Change-Id: Ic05aa3457a45e98ea5dc8e9dd83e0f1a42772070
Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index a0725e6..aa06782 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -440,12 +440,21 @@
// If "LocalRole" info is provided
if (localRole)
{
+ std::string priv = getPrivilegeFromRoleId(*localRole);
+ if (priv.empty())
+ {
+ messages::propertyValueNotInList(
+ asyncResp->res, *localRole,
+ std::format("RemoteRoleMapping/{}/LocalRole",
+ index));
+ return;
+ }
setDbusProperty(
asyncResp,
std::format("RemoteRoleMapping/{}/LocalRole", index),
ldapDbusService, roleMapObjData[index].first,
"xyz.openbmc_project.User.PrivilegeMapperEntry",
- "Privilege", *localRole);
+ "Privilege", priv);
}
}
// Create a new RoleMapping Object.