Skip to main content

system.mes.role.validateRole

Description

Validates a Role object based on the provided parameters. Returns a JSON dictionary of validation violations for each field.

Syntax

system.mes.role.validateRole(**roleData)

Parameters

ParameterTypeNullableDescription
idString (ULID)TrueThe ULID of the role (optional, used for updating an existing role).
enabledBooleanTrueIndicates if the role is active and enabled.
notesStringTrueNotes related to the role.
spare1StringTrueAdditional field for user-defined context.
spare2StringTrueAdditional field for user-defined context.
spare3StringTrueAdditional field for user-defined context.
securityLevelsList<String>FalseList of Ignition security levels required for this role.
permissionsList<String>FalseList of MES permissions granted by this role.
roleRequirementTypeEnumFalseSpecifies if all or any security levels are required to grant permissions. See RoleRequirementType enum.

Returns

Returns a JSON dictionary of validation violations. Each key is a field name, and each value is a list of violations for that field.

Code Examples

# Generate the object structure for a new role object, set the initial arguments and validate it
role = system.mes.role.newRole()
role['securityLevels'] = ['Authenticated/Roles/Administrator']
role['permissions'] = ['MATERIALS.WRITE', 'INVENTORY.READ']
role['roleRequirementType'] = 'ALL_OF'
violations = system.mes.role.validateRole(**role)

# Output the JSON dictionary of validation violations
print(violations)