summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorRAJESWARAN THILLAIGOVINDAN <rajeswgo@in.ibm.com>2019-12-13 13:26:54 +0300
committerT Rajeswaran <rajeswgo@in.ibm.com>2019-12-17 08:06:45 +0300
commit61dbeef97168db1a1f7a351c5f95e09afd361e48 (patch)
tree2a3d9db1a6029998451f7c15d67ded5d398fb3ef /redfish-core
parent1e2cec30813560f17b2d214b81a579b68bd37256 (diff)
downloadbmcweb-61dbeef97168db1a1f7a351c5f95e09afd361e48.tar.xz
Fix authorization for LDAP users
Modified the code to make an asynchronous call to GetUserInfo to get the user role for authorization. For local users, DBus matches are used to store user role map hot in memory. Hence, bmcweb has to know whether a user is a local user or LDAP user to get the role. To avoid this, removed the existing DBus matches and modified the code to call GetUserInfo to get the role of local users as well as LDAP users. Tested: - Created a local user having admin privilege and verified that he is able to restart the system /redfish/v1/Systems/system/Actions/ComputerSystem.Reset -d '{"ResetType": "GracefulRestart"}' - Created a local user having user privilege and verified that he is unauthorized to restart the system /redfish/v1/Systems/system/Actions/ComputerSystem.Reset -d '{"ResetType": "GracefulRestart"}' - Created a remote user having admin privilege and verified that he is able to restart the system /redfish/v1/Systems/system/Actions/ComputerSystem.Reset -d '{"ResetType": "GracefulRestart"}' - Created a remote user having user privilege and verified that he is unauthorized to restart the system /redfish/v1/Systems/system/Actions/ComputerSystem.Reset -d '{"ResetType": "GracefulRestart"}' - Tested Redfish ConfigureSelf privilege Signed-off-by: RAJESWARAN THILLAIGOVINDAN <rajeswgo@in.ibm.com> Change-Id: Ic3e46a0c0aff2cf456c98048350e58e302011c57
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/include/node.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/redfish-core/include/node.hpp b/redfish-core/include/node.hpp
index fddeaa01e5..9086f1e0ef 100644
--- a/redfish-core/include/node.hpp
+++ b/redfish-core/include/node.hpp
@@ -178,9 +178,9 @@ class Node
*/
inline bool isAllowedWithoutConfigureSelf(const crow::Request& req)
{
- const std::string& userRole =
- crow::persistent_data::UserRoleMap::getInstance().getUserRole(
- req.session->username);
+ const std::string& userRole = req.userRole;
+ BMCWEB_LOG_DEBUG << "isAllowedWithoutConfigureSelf for the role "
+ << req.userRole;
Privileges effectiveUserPrivileges =
redfish::getUserPrivileges(userRole);
effectiveUserPrivileges.resetSinglePrivilege("ConfigureSelf");