$object.canReadAttribute($attribute)
canReadAttribute($object, $attribute)
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.
| Name | Type | Type Description | Mandatory | Default |
|---|---|---|---|---|
| object | Business object | The object to check. | yes | |
| attribute | Attribute | The attribute (TLStructuredTypePart) whose read access is checked. | yes |
Type: Boolean
true if the current user may read the attribute on the object, false otherwise.
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.