summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authoranil kumar appana <anil.kumarx.appana@intel.com>2019-06-13 18:06:23 +0300
committeranil.kumarx.appana <anil.kumarx.appana@intel.com>2019-11-07 20:08:23 +0300
commit0d4197e0b9262b21e20d79456ef148407cb52791 (patch)
tree2dcdb52ad928690ab695a77d286a9ae5285ef29f /redfish-core
parent78158631aeab5b77ea9a5f566508285cb839fadf (diff)
downloadbmcweb-0d4197e0b9262b21e20d79456ef148407cb52791.tar.xz
account_service:redfish user creation err handling
Modified POST method to handle redfish user creation error codes. Tested: Tested user creation with below test cases 1)Already user exists 2)Max users reached 3)Username is NULL 4)Username is not starting with alphabet 5)Username exceed more than 16 characters 6)Invalid Password Redfish validator test results: Passed Signed-off-by: anil kumar appana <anil.kumarx.appana@intel.com> Change-Id: I58361ddd4dfd067802f805f9d870b2bc1692ea1d
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/lib/account_service.hpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index bc8ce771d6..0658f3ff3b 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -1429,13 +1429,12 @@ class AccountsCollection : public Node
crow::connections::systemBus->async_method_call(
[asyncResp, username, password{std::move(password)}](
- const boost::system::error_code ec) {
+ const boost::system::error_code ec,
+ sdbusplus::message::message& m) {
if (ec)
{
- messages::resourceAlreadyExists(
- asyncResp->res,
- "#ManagerAccount.v1_0_3.ManagerAccount",
- "UserName", username);
+ userErrorMessageHandler(m.get_error(), asyncResp,
+ username, "");
return;
}
@@ -1446,16 +1445,17 @@ class AccountsCollection : public Node
// but the password set failed.Something is wrong,
// so delete the user that we've already created
crow::connections::systemBus->async_method_call(
- [asyncResp](
- const boost::system::error_code ec) {
+ [asyncResp,
+ password](const boost::system::error_code ec) {
if (ec)
{
messages::internalError(asyncResp->res);
return;
}
- messages::invalidObject(asyncResp->res,
- "Password");
+ // If password is invalid
+ messages::propertyValueFormatError(
+ asyncResp->res, password, "Password");
},
"xyz.openbmc_project.User.Manager",
"/xyz/openbmc_project/user/" + username,