summaryrefslogtreecommitdiff
path: root/include/ibm
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-08-03 03:07:54 +0300
committerEd Tanous <ed@tanous.net>2022-10-07 21:06:08 +0300
commitbb759e3aeaadfec9f3aac4485f253bcc8a523e4c (patch)
tree52e48fbdd2a77c2c6ba583a2d41750e265336a77 /include/ibm
parent40e4f380d645c6bbe6bd8050e501203798a0c488 (diff)
downloadbmcweb-bb759e3aeaadfec9f3aac4485f253bcc8a523e4c.tar.xz
Move ClientID parameter out of OEM
In 2022.2, Redfish added support for the Context parameter on the Session Resource. This parameter has the same function that the OemSession.ClientId field served. This commit moves all the existing ClientId code to produce Context as well. Functionally, this has one important difference, in that Context in Redfish is optionally provided by the user, which means we need to omit it if not given by the user. The old implementation left it set to empty string (""). Because of this, a few minor interfaces need to change to use std::optional. Existing uses of clientId are moved to using value_or("") to keep the same behavior as before. Tested: curl --insecure -X POST -d "{\"UserName\": \"root\", \"Password\": \"0penBmc\"}" https://192.168.7.2/redfish/v1/SessionService/Sessions Returns a Session object with no Context key present curl --insecure -X POST -d "{\"UserName\": \"root\", \"Password\": \"0penBmc\", \"Context\": \"Foobar\"}" https://192.168.7.2/redfish/v1/SessionService/Sessions Returns a Session object with: "Context": "Foobar" Subsequent Gets of /redfish/v1/SessionService/Sessions/<sid> return the same session objects, both with and without Context. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4df358623f93f3e6cb659e99970ad909cefebc62
Diffstat (limited to 'include/ibm')
-rw-r--r--include/ibm/management_console_rest.hpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 0a8b146715..97ac497aec 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -448,9 +448,10 @@ inline void
segInfo.push_back(std::make_pair(lockFlags, segmentLength));
}
- lockRequestStructure.push_back(
- make_tuple(req.session->uniqueId, req.session->clientId, lockType,
- resourceId, segInfo));
+
+ lockRequestStructure.push_back(make_tuple(
+ req.session->uniqueId, req.session->clientId.value_or(""), lockType,
+ resourceId, segInfo));
}
// print lock request into journal
@@ -557,8 +558,8 @@ inline void
// validate the request ids
auto varReleaselock = crow::ibm_mc_lock::Lock::getInstance().releaseLock(
- listTransactionIds,
- std::make_pair(req.session->clientId, req.session->uniqueId));
+ listTransactionIds, std::make_pair(req.session->clientId.value_or(""),
+ req.session->uniqueId));
if (!varReleaselock.first)
{