Make propertyValueNotInList typesafe

The error codes for this function accept a string_view, which has caused
a number of cases of users of this function to call dump() to_string()
and all manner of other conversions.  Considering that dump() is
something that's difficult to call correctly, and overly wordy, it would
be ideal if the message code just handled that for us.

Therefore, this commit changes the prototype to include a nlohmann::json
object as an argument instead of string_view, then audits the codebase
for all uses, and moves them to a more normalized usage, which allows
the calling code to call "dump" for them.

Tested: PATCH /redfish/v1/SessionService {"SessionTimeout": 1}

Returns the PropertyValueNotInList error as it did before.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If62909072db1f067ad1f8aa590bb716c84181219
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 6cbb405..5e9de4e 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -1215,8 +1215,8 @@
     {
         if (serviceAddressList->empty())
         {
-            messages::propertyValueNotInList(asyncResp->res, "[]",
-                                             "ServiceAddress");
+            messages::propertyValueNotInList(
+                asyncResp->res, *serviceAddressList, "ServiceAddress");
             return;
         }
     }
@@ -1224,7 +1224,7 @@
     {
         if (baseDNList->empty())
         {
-            messages::propertyValueNotInList(asyncResp->res, "[]",
+            messages::propertyValueNotInList(asyncResp->res, *baseDNList,
                                              "BaseDistinguishedNames");
             return;
         }
@@ -1388,8 +1388,8 @@
                 std::string priv = getPrivilegeFromRoleId(*roleId);
                 if (priv.empty())
                 {
-                    messages::propertyValueNotInList(asyncResp->res, *roleId,
-                                                     "RoleId");
+                    messages::propertyValueNotInList(asyncResp->res, true,
+                                                     "Locked");
                     return;
                 }
 
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index d4df6c8..62704c9 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -719,8 +719,8 @@
     // time consumed in generating private key
     if (*optKeyPairAlgorithm == "RSA" && *optKeyBitLength != rsaKeyBitLength)
     {
-        messages::propertyValueNotInList(
-            asyncResp->res, std::to_string(*optKeyBitLength), "KeyBitLength");
+        messages::propertyValueNotInList(asyncResp->res, *optKeyBitLength,
+                                         "KeyBitLength");
         return;
     }
 
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 21f74b7..362fdef 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1559,8 +1559,8 @@
                 if (createNewObject && it.value() == nullptr)
                 {
                     // can't delete a non-existent object
-                    messages::propertyValueNotInList(response->res,
-                                                     it.value().dump(), name);
+                    messages::propertyValueNotInList(response->res, it.value(),
+                                                     name);
                     continue;
                 }
 
diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp
index 0608333..4c98974 100644
--- a/redfish-core/lib/redfish_sessions.hpp
+++ b/redfish-core/lib/redfish_sessions.hpp
@@ -319,8 +319,7 @@
         }
         else
         {
-            messages::propertyValueNotInList(asyncResp->res,
-                                             std::to_string(*sessionTimeout),
+            messages::propertyValueNotInList(asyncResp->res, *sessionTimeout,
                                              "SessionTimeOut");
         }
     }