Implementation of statement to role?

Hello, is it possible to make an ‘if’ statement to the role? For example:
I created role ProjectOwner which allows to modify and update projects but I want it to be ‘activated’ when logged user is in fact Project.owner .

Is it somehow predicted in JMIX to use roles in this way? Or maybe there is another way to do it properly?

A row-level role with predicate policy will help with your requirements.
It allows to deny update or remove operations based on individual entity’s attributes.

1 Like

And how to give to return the current authentication user?

Something like this:

default Predicate projectOwnerModify() {
return project → Boolean.TRUE.equals(project.getOwner().equals((User) currentAuthentication.getUser()));

You can pass any Spring bean including CurrentAuthentication as parameter to the projectOwnerModify method.

It’s not documented yet: