Redfish(AccountService): Send the correct error message for the read only property
MinPasswordLength and MaxPasswordLength is a readOnly property
in the account service schema, so send the correct message
if the user tries to PATCH these properties.
Change-Id: If231ca13ef97fc05928435ac14a8190a186beb06
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 045f40c..1b7b4b8 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -167,12 +167,28 @@
std::optional<uint32_t> unlockTimeout;
std::optional<uint16_t> lockoutThreshold;
+ std::optional<uint16_t> minPasswordLength;
+ std::optional<uint16_t> maxPasswordLength;
+
if (!json_util::readJson(req, res, "AccountLockoutDuration",
unlockTimeout, "AccountLockoutThreshold",
- lockoutThreshold))
+ lockoutThreshold, "MaxPasswordLength",
+ maxPasswordLength, "MinPasswordLength",
+ minPasswordLength))
{
return;
}
+
+ if (minPasswordLength)
+ {
+ messages::propertyNotWritable(asyncResp->res, "MinPasswordLength");
+ }
+
+ if (maxPasswordLength)
+ {
+ messages::propertyNotWritable(asyncResp->res, "MaxPasswordLength");
+ }
+
if (unlockTimeout)
{
crow::connections::systemBus->async_method_call(