Restricting user updates on a multi-valued reference field based on permissions

Resolved

I have a multi-valued field containing references to organizations.
I want to allow users to modify this field via an action button, but only to add or remove organizations for which they have the appropriate permissions.

Currently, if I create a feature that directly includes this field, users are able to remove existing organizations from the field, even those for which they have no permissions.

What is the correct approach to restrict modifications so that users can manage only the organizations they are authorized for?

Role model
3 replies
Best reply by Paul LEDOUX

To achieve this, it is possible to use a validationRule at the object type definition level.
Then, by using OPERATION.originalObject.field_to_check and OBJECT.field_to_check, we can identify the difference and verify that this difference falls within the scope of the person who performed the action.

Important: To retrieve the permissions of the currently connected user at this level, you cannot use the SUBJECT binding (which in this case corresponds to system). Instead, you must use REQUESTER.

Best Regards,
Paul.

View original