Syntax

$object.canWrite()

canWrite($object)

Description

Checks whether the currently logged-in user is allowed to modify the given object (object-level write access) and returns a boolean.

The function never fails and never filters; it lets a script check write access up front instead of running into the permission error that a modifying operation would raise.

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 whose write access is checked.yes

Return value

Type: Boolean

true if the current user may modify the object, false otherwise (in particular for null).

Examples

Example 1

all(`my.module:Contract`).filter(c -> $c.canWrite())

Output: All contracts that the logged-in user is allowed to modify.