diff options
author | Jorge Cisneros <jcisneros3@lenovo.com> | 2022-11-04 19:26:25 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-01-04 03:05:55 +0300 |
commit | 329f0348f10ee9a0b51ae7b416862fcbea05f19f (patch) | |
tree | 1bae7e4a157a47d1b2b16b82f9e223021f1be000 | |
parent | d51e39d958a63f01b5cfbbc8e9c54b0694f8c104 (diff) | |
download | bmcweb-329f0348f10ee9a0b51ae7b416862fcbea05f19f.tar.xz |
Problem with RemoteRoleMapping JSON
The current LDAP group map on /redfish/v1/AccountService is incorrect
and is creating a bad JSON response. instead of an array of objects, is
creating a nested array of objects. The problem is visible on the
website adding a new LDAP group map, it will show 2 empty rows instead
of one with the correct data.
The current JSON data is:
"RemoteRoleMapping": [
[
{
"RemoteGroup": "groupname"
}
],
[
{
"LocalRole": "Operator"
}
]
],
The correct JSON is:
"RemoteRoleMapping": [
{
"LocalRole": "Operator",
"RemoteGroup": "groupname"
}
],
The tests redfish/account_service/test_ldap_configuration crashed
BMCWEB generates around 9 core dump files.
Tested:
redfish/account_service/test_ldap_configuration passed the tests
Adding a new LDAP group map on the website, showing the correct data,
Change-Id: I5de7db372ceff1cc596da2b04f5fd730415f7216
Signed-off-by: Jorge Cisneros <jcisneros3@lenovo.com>
-rw-r--r-- | redfish-core/lib/account_service.hpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp index 58b3362e6e..131f59f7a2 100644 --- a/redfish-core/lib/account_service.hpp +++ b/redfish-core/lib/account_service.hpp @@ -231,17 +231,10 @@ inline void parseLDAPConfigData(nlohmann::json& jsonResponse, BMCWEB_LOG_DEBUG << "Pushing the data groupName=" << obj.second.groupName << "\n"; - nlohmann::json::array_t remoteGroupArray; nlohmann::json::object_t remoteGroup; remoteGroup["RemoteGroup"] = obj.second.groupName; - remoteGroupArray.emplace_back(std::move(remoteGroup)); - roleMapArray.emplace_back(std::move(remoteGroupArray)); - - nlohmann::json::array_t localRoleArray; - nlohmann::json::object_t localRole; - localRole["LocalRole"] = getRoleIdFromPrivilege(obj.second.privilege); - localRoleArray.emplace_back(std::move(localRole)); - roleMapArray.emplace_back(std::move(localRoleArray)); + remoteGroup["LocalRole"] = getRoleIdFromPrivilege(obj.second.privilege); + roleMapArray.emplace_back(std::move(remoteGroup)); } } |