Groovy constraint - substituted user

Hi, how can I access substituted user ID inside of groovy script used as Update constraint?
Current situation: User admin has user jozef set as substituted user.
Right now I am using following code:
return ({E}.user.id == userSession.user.id)
where userSession.user.id returns ID of user admin, instead of user jozef, so user jozef can update all entities which have user admin set in property user and can’t update his own.

Can you help me?

I found it,
substitued user id can be used as userSession.currentOrSubstitutedUser.id. Maybe it will help someone. This question can be closed.

1 Like