diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2020-06-12 04:55:21 +0300 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2020-06-12 05:55:17 +0300 |
commit | 8114bd4d9ba4b927ecd2c2eeb3fc0885f684ad25 (patch) | |
tree | 33bc7c899a8a75216b6241384e8cb4936c20214a /redfish-core | |
parent | 7f1538cc79b9613c6d5536c6e6951ee6372eabf3 (diff) | |
download | bmcweb-8114bd4d9ba4b927ecd2c2eeb3fc0885f684ad25.tar.xz |
ManagerAccount: Implement AccountTypes
Seeing "ERROR - AccountTypes: Mandatory prop does not exist" validator
fails. This should not be an error, because bmcweb is using
ManagerAccount.v1_3_0 which doesn't have this property. The workaround
(implement AccountTypes) improves the code, more information and easier
later when moving to a later schema, so bump the ManagerAccount schema
and Implement AccountTypes.
Taking this issue forward with Redfish.
Believe this was introduced in the following Validator commit:
https://github.com/DMTF/Redfish-Service-Validator/commit/de71f0388bf85c920ae48deb6b16aed124f4f23b
From https://redfish.dmtf.org/schemas/ManagerAccount.v1_6_0.json:
"AccountTypes": {
"description": "The account types.",
"items": {
"anyOf": [
{
"$ref": "#/definitions/AccountTypes"
},
...
"versionAdded": "v1_4_0"
},
...
"required": [
"@odata.id",
"@odata.type",
"Id",
"Name",
"AccountTypes"
],
...
"AccountTypes": {
"enum": [
"Redfish",
"SNMP",
"OEM"
],
"enumDescriptions": {
"OEM": "OEM account type.",
"Redfish": "Allow access to the Redfish Service.",
"SNMP": "Allow access to SNMP services."
},
"type": "string"
Tested: Built and latest validator passes on a Witherspoon.
curl -k https://${bmc}/redfish/v1/AccountService/Accounts/root
{
"@odata.id": "/redfish/v1/AccountService/Accounts/root",
"@odata.type": "#ManagerAccount.v1_4_0.ManagerAccount",
"AccountTypes": [
"Redfish"
],
Change-Id: If48c4b8deb5f199f459858bb2c7469f0ebd44781
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'redfish-core')
-rw-r--r-- | redfish-core/lib/account_service.hpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp index 8c67f36b22..30f34fa49c 100644 --- a/redfish-core/lib/account_service.hpp +++ b/redfish-core/lib/account_service.hpp @@ -133,14 +133,14 @@ void userErrorMessageHandler(const sd_bus_error* e, "xyz.openbmc_project.User.Common.Error.UserNameExists") == 0) { messages::resourceAlreadyExists(asyncResp->res, - "#ManagerAccount.v1_3_0.ManagerAccount", + "#ManagerAccount.v1_4_0.ManagerAccount", "UserName", newUser); } else if (strcmp(errorMessage, "xyz.openbmc_project.User.Common.Error." "UserNameDoesNotExist") == 0) { messages::resourceNotFound( - asyncResp->res, "#ManagerAccount.v1_3_0.ManagerAccount", username); + asyncResp->res, "#ManagerAccount.v1_4_0.ManagerAccount", username); } else if (strcmp(errorMessage, "xyz.openbmc_project.Common.Error.InvalidArgument") == 0) @@ -1576,10 +1576,11 @@ class ManagerAccount : public Node } asyncResp->res.jsonValue = { - {"@odata.type", "#ManagerAccount.v1_3_0.ManagerAccount"}, + {"@odata.type", "#ManagerAccount.v1_4_0.ManagerAccount"}, {"Name", "User Account"}, {"Description", "User Account"}, - {"Password", nullptr}}; + {"Password", nullptr}, + {"AccountTypes", {"Redfish"}}}; for (const auto& interface : userIt->second) { @@ -1773,7 +1774,7 @@ class ManagerAccount : public Node if (!rc) { messages::resourceNotFound( - asyncResp->res, "#ManagerAccount.v1_3_0.ManagerAccount", + asyncResp->res, "#ManagerAccount.v1_4_0.ManagerAccount", username); return; } @@ -1786,7 +1787,7 @@ class ManagerAccount : public Node { messages::resourceNotFound( asyncResp->res, - "#ManagerAccount.v1_3_0.ManagerAccount", username); + "#ManagerAccount.v1_4_0.ManagerAccount", username); } else if (retval == PAM_AUTHTOK_ERR) { @@ -1908,7 +1909,7 @@ class ManagerAccount : public Node if (ec) { messages::resourceNotFound( - asyncResp->res, "#ManagerAccount.v1_3_0.ManagerAccount", + asyncResp->res, "#ManagerAccount.v1_4_0.ManagerAccount", username); return; } |