Skip to content

Commit

Permalink
Added write only check for permissions such as password
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas <[email protected]>
  • Loading branch information
tomasg2012 committed May 2, 2024
1 parent 4f1aa87 commit 5690e21
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion redfish_service_validator/validateRedfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def checkPropertyConformance(service, prop_name, prop, parent_name=None, parent_
return {prop_name: ('-', '-', 'Yes' if prop.Exists else 'No', 'OEM')}, counts

# Parameter Passes
paramPass = propMandatoryPass = propNullablePass = deprecatedPassOrSinceVersion = nullValid = True
paramPass = propMandatoryPass = propNullablePass = deprecatedPassOrSinceVersion = nullValid = permissionValid = True

if prop.Type.IsMandatory:
propMandatoryPass = True if prop.Exists else False
Expand Down Expand Up @@ -550,6 +550,13 @@ def checkPropertyConformance(service, prop_name, prop, parent_name=None, parent_

if prop.Exists:
paramPass = propNullablePass = True

# <Annotation Term="OData.Permissions" EnumMember="OData.Permission/ReadWrite"/>
if prop.Type.Permissions == "OData.Permission/Write":
if val is not None:
my_logger.error('{}: Permissions for this property are Write only, reading this property should be null!!!'.format(sub_item))
counts['failWriteOnly'] += 1

if val is None:
if propNullable:
my_logger.debug('Property {} is nullable and is null, so Nullable checking passes'.format(sub_item))
Expand Down

0 comments on commit 5690e21

Please sign in to comment.