Syntax

$object.canReadAttribute($attribute)

canReadAttribute($object, $attribute)

Description

Checks whether the currently logged-in user is allowed to read the given attribute of the given object and returns a boolean.

This is the attribute-level counterpart of canRead. The user needs both read access to the object and (if configured) the attribute-specific role. The function never fails and never filters.

The check is evaluated for the currently logged-in user and follows the same rules as the implicit permission enforcement: deny-by-default, role inheritance along the security hierarchy, and full access for administrators or executions in a system context.

Parameters

NameTypeType DescriptionMandatoryDefault
objectBusiness objectThe object to check.yes
attributeAttributeThe attribute (TLStructuredTypePart) whose read access is checked.yes

Return value

Type: Boolean

true if the current user may read the attribute on the object, false otherwise.

Examples

Example 1

if($contract.canReadAttribute(`my.module:Contract#volume`), $contract.get(`my.module:Contract#volume`), null)

Output: The contract volume if the logged-in user may read that attribute, otherwise null.