Exemplo n.º 1
0
 public AccountController(
     IUserService userService,
     SignInManager <IUser> signInManager,
     UserManager <IUser> userManager,
     ILogger <AccountController> logger,
     ISiteService siteService,
     IStringLocalizer <AccountController> stringLocalizer,
     IEnumerable <ILoginFormEvent> accountEvents,
     IScriptingManager scriptingManager,
     IClock clock,
     IDistributedCache distributedCache,
     IDataProtectionProvider dataProtectionProvider,
     IEnumerable <IExternalLoginEventHandler> externalLoginHandlers,
     IEnumerable <ILogOutEvent> accountLogOutEvents
     )
 {
     _signInManager          = signInManager;
     _userManager            = userManager;
     _userService            = userService;
     _logger                 = logger;
     _siteService            = siteService;
     _accountEvents          = accountEvents;
     _scriptingManager       = scriptingManager;
     _clock                  = clock;
     _distributedCache       = distributedCache;
     _dataProtectionProvider = dataProtectionProvider;
     _externalLoginHandlers  = externalLoginHandlers;
     S = stringLocalizer;
     _accountLogOutEvents = accountLogOutEvents;
 }
Exemplo n.º 2
0
        public ScriptExecutionAction(IScriptingManager scriptingManager, IContentManager contentManager)
        {
            _scriptingManager = scriptingManager;
            _contentManager   = contentManager;

            T = NullLocalizer.Instance;
        }
Exemplo n.º 3
0
        public ScriptExecutionForms(IShapeFactory shapeFactory, IScriptingManager scriptingManager)
        {
            Shape             = shapeFactory;
            _scriptingManager = scriptingManager;

            T = NullLocalizer.Instance;
        }
        /// <summary>
        /// Traverse all the nodes of the json document and replaces their value if they are scripted.
        /// </summary>
        private void EvaluateJsonTree(IScriptingManager scriptingManager, JToken node)
        {
            switch (node.Type)
            {
            case JTokenType.Array:
                var array = (JArray)node;
                for (var i = 0; i < array.Count; i++)
                {
                    EvaluateJsonTree(scriptingManager, array[i]);
                }
                break;

            case JTokenType.Object:
                foreach (var property in (JObject)node)
                {
                    EvaluateJsonTree(scriptingManager, property.Value);
                }
                break;

            case JTokenType.String:

                var value = node.Value <string>();

                // Evaluate the expression while the result is another expression
                while (value.StartsWith("[") && value.EndsWith("]"))
                {
                    value = value.Trim('[', ']');
                    value = (scriptingManager.Evaluate(value) ?? "").ToString();
                    ((JValue)node).Value = value;
                }
                break;
            }
        }
Exemplo n.º 5
0
 public void Init() {
     var builder = new ContainerBuilder();
     builder.RegisterType<RubyScriptingRuntime>().As<IScriptingRuntime>();
     builder.RegisterType<ScriptingManager>().As<IScriptingManager>();
     _container = builder.Build();
     _scriptingManager = _container.Resolve<IScriptingManager>();
 }
        public ScriptExecutionAction(IScriptingManager scriptingManager, IContentManager contentManager)
        {
            _scriptingManager = scriptingManager;
            _contentManager = contentManager;

            T = NullLocalizer.Instance;
        }
 public VueFormController(
     ILogger <VueFormController> logger,
     IContentManager contentManager,
     IAuthorizationService authorizationService,
     IContentDefinitionManager contentDefinitionManager,
     IContentItemDisplayManager contentItemDisplayManager,
     IUpdateModelAccessor updateModelAccessor,
     IScriptingManager scriptingManager,
     ILiquidTemplateManager liquidTemplateManager,
     HtmlEncoder htmlEncoder,
     IShortcodeService shortcodeService,
     IContentPermissionsService contentPermissionsService,
     IStringLocalizer <VueFormController> stringLocalizer,
     IWorkflowManager workflowManager = null
     )
 {
     _logger                    = logger;
     _contentManager            = contentManager;
     _contentDefinitionManager  = contentDefinitionManager;
     _contentItemDisplayManager = contentItemDisplayManager;
     _updateModelAccessor       = updateModelAccessor;
     _scriptingManager          = scriptingManager;
     _liquidTemplateManager     = liquidTemplateManager;
     _htmlEncoder               = htmlEncoder;
     _shortcodeService          = shortcodeService;
     _contentPermissionsService = contentPermissionsService;
     S = stringLocalizer;
     _workflowManager      = workflowManager;
     _authorizationService = authorizationService;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Traverse all the nodes of the json document and replaces their value if they are scripted.
        /// </summary>
        private void EvaluateJsonTree(IScriptingManager scriptingManager, RecipeExecutionContext context, JToken node)
        {
            switch (node.Type)
            {
            case JTokenType.Array:
                var array = (JArray)node;
                for (var i = 0; i < array.Count; i++)
                {
                    EvaluateJsonTree(scriptingManager, context, array[i]);
                }
                break;

            case JTokenType.Object:
                foreach (var property in (JObject)node)
                {
                    EvaluateJsonTree(scriptingManager, context, property.Value);
                }
                break;

            case JTokenType.String:

                var value = node.Value <string>();

                // Evaluate the expression while the result is another expression
                while (value.StartsWith('[') && value.EndsWith(']'))
                {
                    value = value.Trim('[', ']');
                    value = (scriptingManager.Evaluate(value, context.RecipeDescriptor.FileProvider, context.RecipeDescriptor.BasePath, null) ?? "").ToString();
                    ((JValue)node).Value = value;
                }
                break;
            }
        }
Exemplo n.º 9
0
 public JavaScriptExpressionEvaluator(
     IScriptingManager scriptingManager,
     IEnumerable <IWorkflowExecutionEventHandler> workflowContextHandlers,
     ILogger <JavaScriptExpressionEvaluator> logger)
 {
     _scriptingManager        = scriptingManager;
     _workflowContextHandlers = workflowContextHandlers;
     _logger = logger;
 }
        public void Init()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <RubyScriptingRuntime>().As <IScriptingRuntime>();
            builder.RegisterType <ScriptingManager>().As <IScriptingManager>();
            _container        = builder.Build();
            _scriptingManager = _container.Resolve <IScriptingManager>();
        }
 public ScriptConsole(Window w)
 {
     DataContext = this;
     _parent = w;
     _scriptmanager = CompositionManager.Get<IScriptingManager>();
     _scriptlibrary = CompositionManager.Get<IScriptingLibrarian>();
     _scriptconfiguration = CompositionManager.Get<IScriptingConfiguration>();
     InitializeComponent();
 }
Exemplo n.º 12
0
        /// <summary>
        /// Traverse all the nodes of the recipe steps and replaces their value if they are scripted.
        /// </summary>
        private void EvaluateScriptNodes(RecipeExecutionContext context, IScriptingManager scriptingManager)
        {
            if (_variablesMethodProvider != null)
            {
                _variablesMethodProvider.ScriptingManager = scriptingManager;
                scriptingManager.GlobalMethodProviders.Add(_variablesMethodProvider);
            }

            EvaluateJsonTree(scriptingManager, context, context.Step);
        }
Exemplo n.º 13
0
 public ScriptExternalLoginEventHandler(
     ISiteService siteService,
     IScriptingManager scriptingManager,
     ILogger <ScriptExternalLoginEventHandler> logger
     )
 {
     _siteService      = siteService;
     _scriptingManager = scriptingManager;
     _logger           = logger;
 }
        public ScriptingAdminTestbedPartDriver(
            IScriptingManager scriptingManager,
            IContentManager contentManager,
            INotifier notifier)
        {
            _scriptingManager = scriptingManager;
            _contentManager   = contentManager;
            _notifier         = notifier;

            T = NullLocalizer.Instance;
        }
Exemplo n.º 15
0
        public AdminController(
            IScriptingManager scriptingManager,
            IOrchardServices orchardServices)
        {
            _scriptingManager = scriptingManager;
            _orchardServices  = orchardServices;
            _contentManager   = orchardServices.ContentManager;
            _authorizer       = orchardServices.Authorizer;

            T = NullLocalizer.Instance;
        }
Exemplo n.º 16
0
 public JavaScriptWorkflowScriptEvaluator(
     IScriptingManager scriptingManager,
     IEnumerable <IWorkflowExecutionContextHandler> workflowContextHandlers,
     IStringLocalizer <JavaScriptWorkflowScriptEvaluator> localizer,
     ILogger <JavaScriptWorkflowScriptEvaluator> logger
     )
 {
     _scriptingManager        = scriptingManager;
     _workflowContextHandlers = workflowContextHandlers;
     _logger = logger;
     T       = localizer;
 }
Exemplo n.º 17
0
        /// <summary>
        ///   Set scripting frontend
        ///   Call this before Run()
        /// </summary>
        /// <param name="scriptingFrontend"></param>
        public void SetScripting(IScriptingManager scriptingFrontend)
        {
            if (_scriptingManager != null)
            {
                throw new Exception($"Scripting has already set to {_scriptingManager.GetType().Name}");
            }

            // We not actually initialize scripting here, because Initialize() not called yet
            // see SetScripting
            _scriptingManager = scriptingFrontend;
            LogManager.Log($"Using scripting frontend: {scriptingFrontend.GetType().Name}");
        }
Exemplo n.º 18
0
        public DynamicResourcesFilter(IScriptingManager scriptingManager, ILayoutAccessor layoutAccessor,
                                      IUpdateModelAccessor modelUpdaterAccessor, IContentManager contentManager,
                                      IContentItemDisplayManager contentItemDisplayManager, IDynamicResourcesService dynamicResourcesService)
        {
            _scriptingManager     = scriptingManager;
            _modelUpdaterAccessor = modelUpdaterAccessor;
            _layoutAccessor       = layoutAccessor;

            _contentManager            = contentManager;
            _contentItemDisplayManager = contentItemDisplayManager;
            _dynamicResourcesService   = dynamicResourcesService;
        }
Exemplo n.º 19
0
        /// <summary>
        /// Traverse all the nodes of the json document and replaces their value if they are scripted.
        /// </summary>
        private void EvaluateJsonTree(IScriptingManager scriptingManager, RecipeExecutionContext context, JToken node)
        {
            switch (node.Type)
            {
            case JTokenType.Array:
                var array = (JArray)node;
                for (var i = 0; i < array.Count; i++)
                {
                    EvaluateJsonTree(scriptingManager, context, array[i]);
                }

                break;

            case JTokenType.Object:
                foreach (var property in (JObject)node)
                {
                    EvaluateJsonTree(scriptingManager, context, property.Value);
                }

                break;

            case JTokenType.String:
                const char scriptSeparator = ':';
                var        value           = node.Value <string>();

                // Evaluate the expression while the result is another expression
                while (value.StartsWith('[') && value.EndsWith(']'))
                {
                    var scriptSeparatorIndex = value.IndexOf(scriptSeparator);
                    // Only remove brackets if this is a valid script expression, e.g. '[js:xxx]', or '[file:xxx]'
                    if (!(scriptSeparatorIndex > -1 && value[1..scriptSeparatorIndex].All(c => Char.IsLetter(c))))
                    {
                        break;
                    }

                    value = value.Trim('[', ']');

                    value = (scriptingManager.Evaluate(
                                 value,
                                 context.RecipeDescriptor.FileProvider,
                                 context.RecipeDescriptor.BasePath,
                                 _methodProviders[context.ExecutionId])
                             ?? "").ToString();

                    ((JValue)node).Value = value;
                }

                break;
            }
        }
Exemplo n.º 20
0
 public void Init() {
     var builder = new ContainerBuilder();
     builder.RegisterType<RubyScriptingRuntime>().As<IScriptingRuntime>();
     builder.RegisterType<ScriptingManager>().As<IScriptingManager>();
     _container = builder.Build();
     _scriptingRuntime = _container.Resolve<IScriptingRuntime>();
     _scriptingManager = _container.Resolve<IScriptingManager>();
     _tempFolderName = _tempFixtureFolderName.Combine(System.IO.Path.GetRandomFileName());
     try {
         _tempFolderName.Delete();
     }
     catch { }
     _tempFolderName.CreateDirectory();
 }
Exemplo n.º 21
0
        /// <summary>
        /// Traverse all the nodes of the recipe steps and replaces their value if they are scripted.
        /// </summary>
        private void EvaluateScriptNodes(RecipeExecutionContext recipeStep, IScriptingManager scriptingManager)
        {
            if (_variablesMethodProvider != null)
            {
                _variablesMethodProvider.ScriptingManager = scriptingManager;
                scriptingManager.GlobalMethodProviders.Add(_variablesMethodProvider);
            }

            if (_applicationLifetime.ApplicationStopping.IsCancellationRequested)
            {
                throw new OrchardException(T["Recipe cancelled, application is restarting"]);
            }

            EvaluateJsonTree(scriptingManager, recipeStep.Step);
        }
Exemplo n.º 22
0
        public void Init()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <RubyScriptingRuntime>().As <IScriptingRuntime>();
            builder.RegisterType <ScriptingManager>().As <IScriptingManager>();
            _container        = builder.Build();
            _scriptingRuntime = _container.Resolve <IScriptingRuntime>();
            _scriptingManager = _container.Resolve <IScriptingManager>();
            _tempFolderName   = _tempFixtureFolderName.Combine(System.IO.Path.GetRandomFileName());
            try {
                _tempFolderName.Delete();
            }
            catch { }
            _tempFolderName.CreateDirectory();
        }
Exemplo n.º 23
0
 public LayerFilter(
     ILayerService layerService,
     ILayoutAccessor layoutAccessor,
     IContentItemDisplayManager contentItemDisplayManager,
     IUpdateModelAccessor modelUpdaterAccessor,
     IScriptingManager scriptingManager,
     IServiceProvider serviceProvider,
     IMemoryCache memoryCache,
     ISignal signal)
 {
     _layerService              = layerService;
     _layoutAccessor            = layoutAccessor;
     _contentItemDisplayManager = contentItemDisplayManager;
     _modelUpdaterAccessor      = modelUpdaterAccessor;
     _scriptingManager          = scriptingManager;
     _serviceProvider           = serviceProvider;
     _memoryCache = memoryCache;
     _signal      = signal;
 }
Exemplo n.º 24
0
 public LayerFilter(
     ILayerService layerService,
     ILayoutAccessor layoutAccessor,
     IContentItemDisplayManager contentItemDisplayManager,
     IUpdateModelAccessor modelUpdaterAccessor,
     IScriptingManager scriptingManager,
     IMemoryCache memoryCache,
     IThemeManager themeManager,
     IAdminThemeService adminThemeService,
     IVolatileDocumentManager <LayerState> layerStateManager)
 {
     _layerService              = layerService;
     _layoutAccessor            = layoutAccessor;
     _contentItemDisplayManager = contentItemDisplayManager;
     _modelUpdaterAccessor      = modelUpdaterAccessor;
     _scriptingManager          = scriptingManager;
     _memoryCache       = memoryCache;
     _themeManager      = themeManager;
     _adminThemeService = adminThemeService;
     _layerStateManager = layerStateManager;
 }
Exemplo n.º 25
0
 public LayerFilter(
     ILayerService layerService,
     ILayoutAccessor layoutAccessor,
     IContentItemDisplayManager contentItemDisplayManager,
     IUpdateModelAccessor modelUpdaterAccessor,
     IScriptingManager scriptingManager,
     IMemoryCache memoryCache,
     ISignal signal,
     IThemeManager themeManager,
     IAdminThemeService adminThemeService)
 {
     _layerService              = layerService;
     _layoutAccessor            = layoutAccessor;
     _contentItemDisplayManager = contentItemDisplayManager;
     _modelUpdaterAccessor      = modelUpdaterAccessor;
     _scriptingManager          = scriptingManager;
     _memoryCache       = memoryCache;
     _signal            = signal;
     _themeManager      = themeManager;
     _adminThemeService = adminThemeService;
 }
 public VueFormController(
     ILogger <VueFormController> logger,
     IContentManager contentManager,
     IContentDefinitionManager contentDefinitionManager,
     IContentItemDisplayManager contentItemDisplayManager,
     IUpdateModelAccessor updateModelAccessor,
     IScriptingManager scriptingManager,
     ILiquidTemplateManager liquidTemplateManager,
     HtmlEncoder htmlEncoder,
     IWorkflowManager workflowManager = null
     )
 {
     _logger                    = logger;
     _contentManager            = contentManager;
     _contentDefinitionManager  = contentDefinitionManager;
     _contentItemDisplayManager = contentItemDisplayManager;
     _updateModelAccessor       = updateModelAccessor;
     _scriptingManager          = scriptingManager;
     _liquidTemplateManager     = liquidTemplateManager;
     _htmlEncoder               = htmlEncoder;
     _workflowManager           = workflowManager;
 }
Exemplo n.º 27
0
        /// <summary>
        /// Traverse all the nodes of the json document and replaces their value if they are scripted.
        /// </summary>
        private void EvaluateJsonTree(IScriptingManager scriptingManager, JToken node)
        {
            var items = node as IEnumerable <JToken>;

            switch (node.Type)
            {
            case JTokenType.Array:
                foreach (var token in (JArray)node)
                {
                    EvaluateJsonTree(scriptingManager, token);
                }
                break;

            case JTokenType.Object:
                foreach (var property in (JObject)node)
                {
                    if (property.Value.Type == JTokenType.String)
                    {
                        var value = property.Value.Value <string>();

                        // Evaluate the expression while the result is another expression
                        while (value.StartsWith("[") && value.EndsWith("]"))
                        {
                            value = value.Trim('[', ']');
                            value = (scriptingManager.Evaluate(value) ?? "").ToString();
                            node[property.Key] = new JValue(value);
                        }
                    }
                    else
                    {
                        EvaluateJsonTree(scriptingManager, property.Value);
                    }
                }
                break;
            }
        }
 public DynamicLanguagesScriptEngine()
 {
     _scriptingManager = CompositionManager.Get<IScriptingManager>();
     _scriptLibrarian = CompositionManager.Get<IScriptingLibrarian>();
     _scriptingConfiguration = CompositionManager.Get<IScriptingConfiguration>();
 }
 public RubyScriptExpressionEvaluator(IScriptingManager scriptingManager, ICacheManager cacheManager)
 {
     _scriptingManager = scriptingManager;
     _cacheManager     = cacheManager;
 }
Exemplo n.º 30
0
 public VisibilityRuleManager(IScriptingManager scriptingManager, IServiceProvider serviceProvider)
 {
     _scriptingManager = scriptingManager;
     _serviceProvider  = serviceProvider;
 }
Exemplo n.º 31
0
 public JavascriptConditionEvaluator(IScriptingManager scriptingManager, IServiceProvider serviceProvider)
 {
     _scriptingManager = scriptingManager;
     _serviceProvider  = serviceProvider;
 }
 public RubyScriptExpressionEvaluator(IScriptingManager scriptingManager, ICacheManager cacheManager) {
     _scriptingManager = scriptingManager;
     _cacheManager = cacheManager;
 }
        public ScriptExecutionForms(IShapeFactory shapeFactory, IScriptingManager scriptingManager)
        {
            Shape = shapeFactory;
            _scriptingManager = scriptingManager;

            T = NullLocalizer.Instance;
        }
Exemplo n.º 34
0
        /// <summary>
        /// Executes javascript by prefixing the script .
        /// </summary>
        /// <param name="script">The script to evaluate</param>
        /// <param name="scopedMethodProviders">A list of method providers scoped to the script evaluation.</param>
        /// <returns>The result of the script if any.</returns>
        public static object EvaluateJs(this IScriptingManager scriptingManager, string script, params IGlobalMethodProvider[] scopedMethodProviders)
        {
            var directive = $"js:{script}";

            return(scriptingManager.Evaluate(directive, null, null, scopedMethodProviders));
        }