user_mgmt: Enable SOL payload access by default.

Enabling SOL payload access for all users in all channels, by default.
It is not mandated by IPMI spec, but needed for backward-compatibility.

Tested-by:
1. Run Get User Payload Access Command for random user on LAN channel.
   // Command - (channel 3 is of LAN channel type)
   ipmitool  -I lanplus...raw 0x06 0x4D 3 7
   02 00 00 00 // Response

2. Disable SOL payload and rerun Get User Payload Access Command.
   // Command
   ipmitool  -I lanplus...raw 0x06 0x4C 3 0x48 0x02 0 0x00 0
   ipmitool  -I lanplus...raw 0x06 0x4D 3 8
   00 00 00 00 // Response

3. Run Get User Payload Access on non-LAN, session-less channel.
   // Command - (channel 7 is KCS channel type)
   ipmitool  -I lanplus...raw 0x06 0x4D 7 7
   Error:(...rsp=0xcc): Invalid data field in request // Response

4. Check SOL session activation and 'ipmi_user.json' file contents.

Change-Id: I48c50e6366a0025d5ae066c8a8f3694d2f710732
Signed-off-by: Saravanan Palanisamy <saravanan.palanisamy@linux.intel.com>
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index f877981..f835247 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -1211,14 +1211,6 @@
             "Corrupted IPMI user data file - invalid user count");
     }
 
-    // Construct a JSON object with default payload access values.
-    std::array<std::array<bool, ipmiMaxChannels>, payloadsPerByte> stdPayload =
-        {};
-    std::array<std::array<bool, ipmiMaxChannels>, payloadsPerByte> oemPayload =
-        {};
-    static const Json jsonPayloadEnabledDefault =
-        constructJsonPayloadEnables(stdPayload, oemPayload);
-
     // user index 0 is reserved, starts with 1
     for (size_t usrIndex = 1; usrIndex <= ipmiMaxUsers; ++usrIndex)
     {
@@ -1244,33 +1236,45 @@
             userInfo[jsonAccCallbk].get<std::vector<bool>>();
 
         // Payload Enables Processing.
-        auto jsonPayloadEnabled =
-            userInfo.value<Json>(payloadEnabledStr, jsonPayloadEnabledDefault);
-
-        for (auto payloadNum = 0; payloadNum < payloadsPerByte; payloadNum++)
+        std::array<std::array<bool, ipmiMaxChannels>, payloadsPerByte>
+            stdPayload = {};
+        std::array<std::array<bool, ipmiMaxChannels>, payloadsPerByte>
+            oemPayload = {};
+        try
         {
-            std::ostringstream stdPayloadStream;
-            std::ostringstream oemPayloadStream;
-
-            stdPayloadStream << stdPayloadStr << payloadNum;
-            oemPayloadStream << oemPayloadStr << payloadNum;
-
-            stdPayload[payloadNum] =
-                jsonPayloadEnabled[stdPayloadStream.str()]
-                    .get<std::array<bool, ipmiMaxChannels>>();
-            oemPayload[payloadNum] =
-                jsonPayloadEnabled[oemPayloadStream.str()]
-                    .get<std::array<bool, ipmiMaxChannels>>();
-
-            if (stdPayload[payloadNum].size() != ipmiMaxChannels ||
-                oemPayload[payloadNum].size() != ipmiMaxChannels)
+            const auto jsonPayloadEnabled = userInfo.at(payloadEnabledStr);
+            for (auto payloadNum = 0; payloadNum < payloadsPerByte;
+                 payloadNum++)
             {
-                log<level::ERR>("Error in reading IPMI user data file - "
-                                "payload properties corrupted");
-                throw std::runtime_error(
-                    "Corrupted IPMI user data file - payload properties");
+                std::ostringstream stdPayloadStream;
+                std::ostringstream oemPayloadStream;
+
+                stdPayloadStream << stdPayloadStr << payloadNum;
+                oemPayloadStream << oemPayloadStr << payloadNum;
+
+                stdPayload[payloadNum] =
+                    jsonPayloadEnabled[stdPayloadStream.str()]
+                        .get<std::array<bool, ipmiMaxChannels>>();
+                oemPayload[payloadNum] =
+                    jsonPayloadEnabled[oemPayloadStream.str()]
+                        .get<std::array<bool, ipmiMaxChannels>>();
+
+                if (stdPayload[payloadNum].size() != ipmiMaxChannels ||
+                    oemPayload[payloadNum].size() != ipmiMaxChannels)
+                {
+                    log<level::ERR>("Error in reading IPMI user data file - "
+                                    "payload properties corrupted");
+                    throw std::runtime_error(
+                        "Corrupted IPMI user data file - payload properties");
+                }
             }
         }
+        catch (Json::out_of_range& e)
+        {
+            // Key not found in 'userInfo'; possibly an old JSON file. Use
+            // default values for all payloads, and SOL payload default is true.
+            stdPayload[static_cast<uint8_t>(ipmi::PayloadType::SOL)].fill(true);
+        }
 
         if (privilege.size() != ipmiMaxChannels ||
             ipmiEnabled.size() != ipmiMaxChannels ||