summaryrefslogtreecommitdiff
path: root/redfish-core/lib/account_service.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'redfish-core/lib/account_service.hpp')
-rw-r--r--redfish-core/lib/account_service.hpp131
1 files changed, 65 insertions, 66 deletions
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index cb469bd548..173de73e3e 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -211,8 +211,8 @@ inline bool
// Both Redfish and WebUI Account Types are needed to PATCH
if (redfishType ^ webUIType)
{
- BMCWEB_LOG_ERROR
- << "Missing Redfish or WebUI Account Type to set redfish User Group";
+ BMCWEB_LOG_ERROR(
+ "Missing Redfish or WebUI Account Type to set redfish User Group");
messages::strictAccountTypes(res, "AccountTypes");
return false;
}
@@ -243,8 +243,8 @@ inline void
(accountTypes.cend() ==
std::find(accountTypes.cbegin(), accountTypes.cend(), "Redfish")))
{
- BMCWEB_LOG_ERROR
- << "User disabling OWN Redfish Account Type is not allowed";
+ BMCWEB_LOG_ERROR(
+ "User disabling OWN Redfish Account Type is not allowed");
messages::strictAccountTypes(asyncResp->res, "AccountTypes");
return;
}
@@ -264,7 +264,7 @@ inline void
updatedUserGroups, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -342,8 +342,7 @@ inline void parseLDAPConfigData(nlohmann::json& jsonResponse,
roleMapArray = nlohmann::json::array();
for (const auto& obj : confData.groupRoleList)
{
- BMCWEB_LOG_DEBUG << "Pushing the data groupName="
- << obj.second.groupName << "\n";
+ BMCWEB_LOG_DEBUG("Pushing the data groupName={}", obj.second.groupName);
nlohmann::json::object_t remoteGroup;
remoteGroup["RemoteGroup"] = obj.second.groupName;
@@ -376,7 +375,7 @@ inline void handleRoleMapPatch(
index](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -388,7 +387,7 @@ inline void handleRoleMapPatch(
}
else
{
- BMCWEB_LOG_ERROR << "Can't delete the object";
+ BMCWEB_LOG_ERROR("Can't delete the object");
messages::propertyValueTypeError(asyncResp->res, thisJson,
"RemoteRoleMapping/" +
std::to_string(index));
@@ -419,7 +418,7 @@ inline void handleRoleMapPatch(
// Update existing RoleMapping Object
if (index < roleMapObjData.size())
{
- BMCWEB_LOG_DEBUG << "Update Role Map Object";
+ BMCWEB_LOG_DEBUG("Update Role Map Object");
// If "RemoteGroup" info is provided
if (remoteGroup)
{
@@ -439,8 +438,8 @@ inline void handleRoleMapPatch(
std::string_view(
"xyz.openbmc_project.Common.Error.InvalidArgument")))
{
- BMCWEB_LOG_WARNING << "DBUS response error: "
- << ec;
+ BMCWEB_LOG_WARNING("DBUS response error: {}",
+ ec);
messages::propertyValueIncorrect(asyncResp->res,
"RemoteGroup",
*remoteGroup);
@@ -474,8 +473,8 @@ inline void handleRoleMapPatch(
std::string_view(
"xyz.openbmc_project.Common.Error.InvalidArgument")))
{
- BMCWEB_LOG_WARNING << "DBUS response error: "
- << ec;
+ BMCWEB_LOG_WARNING("DBUS response error: {}",
+ ec);
messages::propertyValueIncorrect(
asyncResp->res, "LocalRole", *localRole);
return;
@@ -492,8 +491,8 @@ inline void handleRoleMapPatch(
// Create a new RoleMapping Object.
else
{
- BMCWEB_LOG_DEBUG
- << "setRoleMappingProperties: Creating new Object";
+ BMCWEB_LOG_DEBUG(
+ "setRoleMappingProperties: Creating new Object");
std::string pathString = "RemoteRoleMapping/" +
std::to_string(index);
@@ -520,15 +519,15 @@ inline void handleRoleMapPatch(
dbusObjectPath = ldapConfigObjectName;
}
- BMCWEB_LOG_DEBUG << "Remote Group=" << *remoteGroup
- << ",LocalRole=" << *localRole;
+ BMCWEB_LOG_DEBUG("Remote Group={},LocalRole={}", *remoteGroup,
+ *localRole);
crow::connections::systemBus->async_method_call(
[asyncResp, serverType, localRole,
remoteGroup](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -565,8 +564,8 @@ inline void getLDAPConfigData(const std::string& ldapType,
const dbus::utility::MapperGetObject& resp) {
if (ec || resp.empty())
{
- BMCWEB_LOG_ERROR
- << "DBUS response error during getting of service name: " << ec;
+ BMCWEB_LOG_ERROR(
+ "DBUS response error during getting of service name: {}", ec);
LDAPConfigData empty{};
callback(false, empty, ldapType);
return;
@@ -582,7 +581,7 @@ inline void getLDAPConfigData(const std::string& ldapType,
if (ec2)
{
callback(false, confData, ldapType);
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec2;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec2);
return;
}
@@ -603,8 +602,8 @@ inline void getLDAPConfigData(const std::string& ldapType,
}
else
{
- BMCWEB_LOG_ERROR << "Can't get the DbusType for the given type="
- << ldapType;
+ BMCWEB_LOG_ERROR("Can't get the DbusType for the given type={}",
+ ldapType);
callback(false, confData, ldapType);
return;
}
@@ -808,8 +807,8 @@ inline void handleServiceAddressPatch(
std::string_view(
"xyz.openbmc_project.Common.Error.InvalidArgument")))
{
- BMCWEB_LOG_WARNING
- << "Error Occurred in updating the service address";
+ BMCWEB_LOG_WARNING(
+ "Error Occurred in updating the service address");
messages::propertyValueIncorrect(asyncResp->res,
"ServiceAddresses",
serviceAddressList.front());
@@ -827,7 +826,7 @@ inline void handleServiceAddressPatch(
messages::propertyValueModified(asyncResp->res, "ServiceAddresses",
serviceAddressList.front());
}
- BMCWEB_LOG_DEBUG << "Updated the service address";
+ BMCWEB_LOG_DEBUG("Updated the service address");
});
}
/**
@@ -852,13 +851,13 @@ inline void
const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error occurred in updating the username";
+ BMCWEB_LOG_DEBUG("Error occurred in updating the username");
messages::internalError(asyncResp->res);
return;
}
asyncResp->res.jsonValue[ldapServerElementName]["Authentication"]
["Username"] = username;
- BMCWEB_LOG_DEBUG << "Updated the username";
+ BMCWEB_LOG_DEBUG("Updated the username");
});
}
@@ -883,13 +882,13 @@ inline void
const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error occurred in updating the password";
+ BMCWEB_LOG_DEBUG("Error occurred in updating the password");
messages::internalError(asyncResp->res);
return;
}
asyncResp->res.jsonValue[ldapServerElementName]["Authentication"]
["Password"] = "";
- BMCWEB_LOG_DEBUG << "Updated the password";
+ BMCWEB_LOG_DEBUG("Updated the password");
});
}
@@ -916,7 +915,7 @@ inline void
const sdbusplus::message_t& msg) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error Occurred in Updating the base DN";
+ BMCWEB_LOG_DEBUG("Error Occurred in Updating the base DN");
const sd_bus_error* dbusError = msg.get_error();
if ((dbusError != nullptr) &&
(dbusError->name ==
@@ -941,7 +940,7 @@ inline void
messages::propertyValueModified(
asyncResp->res, "BaseDistinguishedNames", baseDNList.front());
}
- BMCWEB_LOG_DEBUG << "Updated the base DN";
+ BMCWEB_LOG_DEBUG("Updated the base DN");
});
}
/**
@@ -966,8 +965,8 @@ inline void
ldapServerElementName](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error Occurred in Updating the "
- "username attribute";
+ BMCWEB_LOG_DEBUG("Error Occurred in Updating the "
+ "username attribute");
messages::internalError(asyncResp->res);
return;
}
@@ -975,7 +974,7 @@ inline void
auto& searchSettingsJson =
serverTypeJson["LDAPService"]["SearchSettings"];
searchSettingsJson["UsernameAttribute"] = userNameAttribute;
- BMCWEB_LOG_DEBUG << "Updated the user name attr.";
+ BMCWEB_LOG_DEBUG("Updated the user name attr.");
});
}
/**
@@ -1000,8 +999,8 @@ inline void handleGroupNameAttrPatch(
ldapServerElementName](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error Occurred in Updating the "
- "groupname attribute";
+ BMCWEB_LOG_DEBUG("Error Occurred in Updating the "
+ "groupname attribute");
messages::internalError(asyncResp->res);
return;
}
@@ -1009,7 +1008,7 @@ inline void handleGroupNameAttrPatch(
auto& searchSettingsJson =
serverTypeJson["LDAPService"]["SearchSettings"];
searchSettingsJson["GroupsAttribute"] = groupsAttribute;
- BMCWEB_LOG_DEBUG << "Updated the groupname attr";
+ BMCWEB_LOG_DEBUG("Updated the groupname attr");
});
}
/**
@@ -1033,13 +1032,13 @@ inline void handleServiceEnablePatch(
ldapServerElementName](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "Error Occurred in Updating the service enable";
+ BMCWEB_LOG_DEBUG("Error Occurred in Updating the service enable");
messages::internalError(asyncResp->res);
return;
}
asyncResp->res.jsonValue[ldapServerElementName]["ServiceEnabled"] =
serviceEnabled;
- BMCWEB_LOG_DEBUG << "Updated Service enable = " << serviceEnabled;
+ BMCWEB_LOG_DEBUG("Updated Service enable = {}", serviceEnabled);
});
}
@@ -1057,7 +1056,7 @@ inline void
"Cookie", cookie, "SessionToken", sessionToken,
"XToken", xToken, "TLS", tls))
{
- BMCWEB_LOG_ERROR << "Cannot read values from AuthMethod tag";
+ BMCWEB_LOG_ERROR("Cannot read values from AuthMethod tag");
return;
}
@@ -1334,7 +1333,7 @@ inline void updateUserProperties(
// If password is invalid
messages::propertyValueFormatError(asyncResp->res,
*password, "Password");
- BMCWEB_LOG_ERROR << "pamUpdatePassword Failed";
+ BMCWEB_LOG_ERROR("pamUpdatePassword Failed");
}
else if (retval != PAM_SUCCESS)
{
@@ -1356,7 +1355,7 @@ inline void updateUserProperties(
*enabled, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1381,7 +1380,7 @@ inline void updateUserProperties(
priv, [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1409,7 +1408,7 @@ inline void updateUserProperties(
[asyncResp](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+ BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
messages::internalError(asyncResp->res);
return;
}
@@ -1506,8 +1505,8 @@ inline void
return;
}
- BMCWEB_LOG_DEBUG << "Got " << propertiesList.size()
- << "properties for AccountService";
+ BMCWEB_LOG_DEBUG("Got {}properties for AccountService",
+ propertiesList.size());
const uint8_t* minPasswordLength = nullptr;
const uint32_t* accountUnlockTimeout = nullptr;
@@ -1737,7 +1736,7 @@ inline void handleAccountCollectionGet(
if (user.empty())
{
messages::internalError(asyncResp->res);
- BMCWEB_LOG_ERROR << "Invalid firmware ID";
+ BMCWEB_LOG_ERROR("Invalid firmware ID");
return;
}
@@ -1795,7 +1794,7 @@ inline void processAfterCreateUser(
"xyz.openbmc_project.User.Manager", userPath,
"xyz.openbmc_project.Object.Delete", "Delete");
- BMCWEB_LOG_ERROR << "pamUpdatePassword Failed";
+ BMCWEB_LOG_ERROR("pamUpdatePassword Failed");
return;
}
@@ -1854,8 +1853,8 @@ inline void processAfterGetAllGroups(
{
if (!accountTypeUserGroups.empty())
{
- BMCWEB_LOG_ERROR
- << "Only administrator can get HostConsole access";
+ BMCWEB_LOG_ERROR(
+ "Only administrator can get HostConsole access");
asyncResp->res.result(boost::beast::http::status::bad_request);
return;
}
@@ -1921,7 +1920,7 @@ inline void handleAccountCollectionPost(
const std::vector<std::string>& allGroupsList) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "ERROR with async_method_call";
+ BMCWEB_LOG_DEBUG("ERROR with async_method_call");
messages::internalError(asyncResp->res);
return;
}
@@ -1988,7 +1987,7 @@ inline void
if (!effectiveUserPrivileges.isSupersetOf(
requiredPermissionsToChangeNonSelf))
{
- BMCWEB_LOG_DEBUG << "GET Account denied access";
+ BMCWEB_LOG_DEBUG("GET Account denied access");
messages::insufficientPrivilege(asyncResp->res);
return;
}
@@ -2039,7 +2038,7 @@ inline void
std::get_if<bool>(&property.second);
if (userEnabled == nullptr)
{
- BMCWEB_LOG_ERROR << "UserEnabled wasn't a bool";
+ BMCWEB_LOG_ERROR("UserEnabled wasn't a bool");
messages::internalError(asyncResp->res);
return;
}
@@ -2051,9 +2050,9 @@ inline void
std::get_if<bool>(&property.second);
if (userLocked == nullptr)
{
- BMCWEB_LOG_ERROR << "UserLockedForF"
- "ailedAttempt "
- "wasn't a bool";
+ BMCWEB_LOG_ERROR("UserLockedForF"
+ "ailedAttempt "
+ "wasn't a bool");
messages::internalError(asyncResp->res);
return;
}
@@ -2068,15 +2067,15 @@ inline void
std::get_if<std::string>(&property.second);
if (userPrivPtr == nullptr)
{
- BMCWEB_LOG_ERROR << "UserPrivilege wasn't a "
- "string";
+ BMCWEB_LOG_ERROR("UserPrivilege wasn't a "
+ "string");
messages::internalError(asyncResp->res);
return;
}
std::string role = getRoleIdFromPrivilege(*userPrivPtr);
if (role.empty())
{
- BMCWEB_LOG_ERROR << "Invalid user role";
+ BMCWEB_LOG_ERROR("Invalid user role");
messages::internalError(asyncResp->res);
return;
}
@@ -2093,8 +2092,8 @@ inline void
std::get_if<bool>(&property.second);
if (userPasswordExpired == nullptr)
{
- BMCWEB_LOG_ERROR
- << "UserPasswordExpired wasn't a bool";
+ BMCWEB_LOG_ERROR(
+ "UserPasswordExpired wasn't a bool");
messages::internalError(asyncResp->res);
return;
}
@@ -2108,14 +2107,14 @@ inline void
&property.second);
if (userGroups == nullptr)
{
- BMCWEB_LOG_ERROR
- << "userGroups wasn't a string vector";
+ BMCWEB_LOG_ERROR(
+ "userGroups wasn't a string vector");
messages::internalError(asyncResp->res);
return;
}
if (!translateUserGroup(*userGroups, asyncResp->res))
{
- BMCWEB_LOG_ERROR << "userGroups mapping failed";
+ BMCWEB_LOG_ERROR("userGroups mapping failed");
messages::internalError(asyncResp->res);
return;
}