Skip to main content

HI,

 

I have a custom service object written in c#. I have registered this as a custom service type. I have set the Authentication mode for that service object as Service Account in the Smartobject Tester Tool. Now my understanding was that, if I have set this no matter who runs the smartobject it would be run as the service account. Unfortunately, this is not happening according to my error. There is a method in this service object that basically opens an active process instance and then updates a datafield.So the code looks something like.

 

ConnectionSetup connectionSetup = new ConnectionSetup();
connectionSetup.ConnectionString = ConfigurationManager.AppSettingsg"ConnectionStringWithCredentialsOfServiceAccountJustToMakeSure"].ToString();

using (Connection K2Connection = new Connection())
{
K2Connection.Open(connectionSetup);
SourceCode.Workflow.Client.ProcessInstance K2ProcessInstance = K2Connection.OpenProcessInstance(processInstanceId);

K2ProcessInstance.DataFieldsd"ServiceRequestStatus"].Value = "Something"; 

K2ProcessInstance.Update();
}

 

This smartobject is hooked up to a form. Now if i run the form and click the control that executes this method as someone who does not have admin rights. I get the  "28018 K2:DomainExampleUsername does not have permissions to open the process'.

 

I dont understand this because, it should not mater what identity the form is running as, the smartobject should run as the serice account which has admin rights on the process.

 

I have read throught he K2 documentation and it cleary states the following which is not happening:

10716i235CB7251B573464.png

 

Thanks in advance for any solution or suggestions

Hi S0me3one,

 

Attach and debug on K2HostServer.exe and:

1. check the "User" object under the "K2Connection". You can see who it is authenticated against.

2. check your connection string. Did you store this connection string in the K2HostServer.exe.config?

 

Workflow.Client API is always running under the current user's security context. You need to make sure that the "User" object shows the correct user you are trying to connect as.

 

btw, what are you trying to achieve here? It seems kind of strange for you to be updating the data field in this manner. Is the workflow waiting for destination user action now? If yes, is it the current user who runs the method?

 

 

JK.


Hi,

 

The debugger confirmed my initial thoughts. I was runing as the identity of the form users even though the service object is set to run as service account and tomake double sure the connection strig stored in teh host config had the credentials in it. The upgrade to 4.6.9 fixed this issue. It is now runnng as service account.

 

Thanks for your reply.

 

 


Reply