Remove the last instances of json pattern
In the past, we've tried to erradicate the use of
nlohmann::json(initiatlizer_list<...>) because it bloats binary sizes,
as every type is given a new nlohmann constructor.
This commit hunts down the last few places where we call this. There is
still 2 remaining in openbmc_dbus_rest after this, but those are variant
accesses that are difficult to triage, and considering it's a less used
api, they're left as is.
Tested: WIP
Change-Id: Iaac24584bb78bb238da69010b511c1d598bd38bc
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 0e1d3a1..4bfbdd8 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -38,6 +38,7 @@
#include <ranges>
#include <string>
#include <string_view>
+#include <utility>
#include <vector>
namespace redfish
@@ -1907,9 +1908,12 @@
return;
}
asyncResp->res.jsonValue["Locked"] = *userLocked;
+ nlohmann::json::array_t allowed;
+ // can only unlock accounts
+ allowed.emplace_back("false");
asyncResp->res
- .jsonValue["Locked@Redfish.AllowableValues"] = {
- "false"}; // can only unlock accounts
+ .jsonValue["Locked@Redfish.AllowableValues"] =
+ std::move(allowed);
}
else if (property.first == "UserPrivilege")
{