Programmatically set local roles on an document after or in a workflow transition

We need to set some local role settings on an object after it reaches a specific workflow state.

We tried to call a view from a transition script, but as long as we put statements like




in it, we get a

aborting transaction due to no CSRF protection on url http:...


What is the proper way to do the task ?

Disable the protection in your view, if you are sure.