Ejemplo n.º 1
0
        public object GetAutoCompletionPrefix(string guid, string command)
        {
            if (!IsLoggedInUserAuthorized ||
                !SessionElevationManager.IsSessionTokenElevated(ApplicationNames.ISE))
            {
                return(string.Empty);
            }

            PowerShellLog.Info($"Auto completion requested in session '{guid}' by user: '******'");

            var serializer = new JavaScriptSerializer();
            var session    = GetScriptSession(guid);

            try
            {
                var result = serializer.Serialize(CommandCompletion.GetPrefix(session, command));
                return(result);
            }
            finally
            {
                if (string.IsNullOrEmpty(guid))
                {
                    ScriptSessionManager.RemoveSession(session);
                }
            }
        }
        public object GetAutoCompletionPrefix(string guid, string command)
        {
            if (!IsLoggedInUserAuthorized)
            {
                return(string.Empty);
            }
            var serializer = new JavaScriptSerializer();
            var session    = GetScriptSession(guid);

            try
            {
                var result = serializer.Serialize(CommandCompletion.GetPrefix(session, command));
                return(result);
            }
            finally
            {
                if (string.IsNullOrEmpty(guid))
                {
                    ScriptSessionManager.RemoveSession(session);
                }
            }
        }
Ejemplo n.º 3
0
        public object GetAutoCompletionPrefix(string guid, string command)
        {
            if (!WebServiceSettings.ServiceEnabledClient || !Sitecore.Context.IsLoggedIn)
            {
                return(string.Empty);
            }
            var serializer = new JavaScriptSerializer();
            var session    = GetScriptSession(guid);

            try
            {
                var result = serializer.Serialize(CommandCompletion.GetPrefix(session, command));
                return(result);
            }
            finally
            {
                if (string.IsNullOrEmpty(guid))
                {
                    ScriptSessionManager.RemoveSession(session);
                }
            }
        }