public object EvalAsUser(string applicationId, string script)
        {
            object result = null;

            ImpersonationHelper.InvokeAsUser(applicationId, new Action(() =>
            {
                result = this.Engine.Evaluate(script);
            }));
            return(result);
        }
        public object CallAsUser(string applicationId, FunctionInstance function, object thisObj, params object[] arguments)
        {
            if (thisObj == null || thisObj == Null.Value || thisObj == Undefined.Value)
            {
                thisObj = this.Engine.Global;
            }

            object result = null;

            ImpersonationHelper.InvokeAsUser(applicationId, new Action(() =>
            {
                result = function.Call(thisObj, arguments);
            }));

            return(result);
        }
 public void ExecAsUser(string applicationId, string script)
 {
     ImpersonationHelper.InvokeAsUser(applicationId, new Action(() => this.Engine.Execute(script)));
 }