07-15-2015 03:35 AM
<startEvent id="request" activiti:initiator="initiator" />
The authenticated user must be set with the method BEFORE the process instance is started,
try {
identityService.setAuthenticatedUserId("bono");
runtimeService.startProcessInstanceByKey("someProcessKey");
} finally {
identityService.setAuthenticatedUserId(null);
}
{
"processDefinitionKey":"leave",
"variables": [
{
"name":"applyUserId",
"value":"Frank"
}
]
}
We've got a unit test for this: ProcessInstanceCollectionResourceTest.testStartProcess().
I ran this here, and it fills the start user just fine (user is set by client.setChallengeResponse(ChallengeScheme.HTTP_BASIC, "kermit", "kermit");
)
Did you somehowe tweak the rest api or have a custom authenticator?
<!– Restlet adapter –>
<servlet>
<servlet-name>RestletServlet</servlet-name>
<servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
<init-param>
<!– Application class name –>
<param-name>org.restlet.application</param-name>
<param-value>com.phzc.activiti.custom.filter.CustomActivitiRestServicesApplication</param-value>
</init-param>
</servlet>
public class CustomActivitiRestServicesApplication extends ActivitiRestServicesApplication {
protected RestResponseFactory restResponseFactory;
public CustomActivitiRestServicesApplication() {
super();
restAuthenticator = new RestAuthenticatorImpl();
setRestAuthenticator(restAuthenticator);
}
@Override
public String authenticate(Request request, Response response) {
if(request.getClientInfo() != null) {
if(request.getClientInfo().getUser() != null) {
return request.getClientInfo().getUser().getIdentifier();
}
}
return "system user";
}
}
public class RestAuthenticatorImpl implements RestAuthenticator {
@Override
public boolean requestRequiresAuthentication(Request request) {
return false;
}
@Override
public boolean isRequestAuthorized(Request request) {
return false;
}
}
07-19-2015 12:00 AM
07-20-2015 11:57 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.