Right permission to write property on workflow instance (WF_model_instance/data/metaData) | Community
Skip to main content
Level 3
February 20, 2023
Solved

Right permission to write property on workflow instance (WF_model_instance/data/metaData)

  • February 20, 2023
  • 2 replies
  • 1209 views

Dear community,

 

I use the code (in WorkflowProcess) below to write a value on the workflow instance.

if (!filePath.isBlank()) { workItem.getWorkflowData().getMetaDataMap().put("filePath", filePath); }

It seems that the permission of previous participant matters here.

If I use admin on previous participant step, the code works, but not for other custom users.

 

I've tried adding "jcr:write", "rep:write" permissions on the custom user, but they don't work in this case.

Could anyone told me what's the right permission to set, or I should includ the custom user into certain group?

 

Thanks! 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jagadeesh_Prakash

@yusheng We facing similar issue in one of the project. It was resolved by getting the user session from below code and also making sure that the user access to the payload path

 

String payloadPath = workItem.getWorkflowData().getPayload().toString();
        ResourceResolver resolver = wfsession.adaptTo(ResourceResolver.class);
        Resource res = resolver.getResource(payloadPath);
        Session session = resolver.adaptTo(Session.class);

 

And also make sure that he is part the workflow users group

2 replies

Shashi_Mulugu
Community Advisor
Community Advisor
February 20, 2023

@yusheng Did you try providing the write permissions to /var/workflow/instances/ folder?

YuShengAuthor
Level 3
February 20, 2023

Hi @shashi_mulugu 

Do you mean providing write permission to the user I created?

Yes I did try adding "jcr:write" permission on it.

 

The workflow process is like

1. dialog participant step (upload file and set the path to payload)

2. process step (fetch the path in payload and write it on instance metadata)

 

If I set participant user in first step to administrator, the process step can successfully write(put) the property on wf instance, but if the participant user is not in administrator group, the second step doesn't work.

Since it's not possible to set the user as administrator, I suppose I need the right permission for the custom user to make it work.

Jagadeesh_Prakash
Community Advisor
Jagadeesh_PrakashCommunity AdvisorAccepted solution
Community Advisor
February 20, 2023

@yusheng We facing similar issue in one of the project. It was resolved by getting the user session from below code and also making sure that the user access to the payload path

 

String payloadPath = workItem.getWorkflowData().getPayload().toString();
        ResourceResolver resolver = wfsession.adaptTo(ResourceResolver.class);
        Resource res = resolver.getResource(payloadPath);
        Session session = resolver.adaptTo(Session.class);

 

And also make sure that he is part the workflow users group

YuShengAuthor
Level 3
February 21, 2023

I found the problem, the custom user doesn't actually successfully write the property onto payload. So the second step surely get nothing from payload.

It is about the right permission to set content/proj... (payload), not the instance.

 

Sorry for the misleading information I provided, and big thanks to @jagadeesh_prakash @shashi_mulugu for the help.

Will mark @jagadeesh_prakash 's answer as correct reply.