7

I have a GUI Extension calling the core service to publish a page. However, the publish user is always the impersonation user. I want the publish user to be the one using the GUI. I have the following code, but it only works when I add an impersonation user, and the actions are then performed by the impersonation user:

string binding = "netTcp_2011";

using (var client = new SessionAwareCoreServiceClient(binding))
{
    client.Impersonate("robert");  
    //....
    client.Publish(arrItems, instruction, target.ToArray(), GetPublishPriority(publishItem.Priority), readoptions);
}

Is there any way to execute the client.Publish command under the identity of the GUI user?

6

This happens because your code is executed by the Application Pool user (defaults to Network Service) which is not allowed to use Tridion - for a very good reason.

You can use HttpContext.Current.User.Identity.Name to get the current user.

client.Impersonate(HttpContext.Current.User.Identity.Name);

PS - This will work for Windows and LDAP or SSO users too.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.