Exemple #1
0
        public ActionResult Create(string id)
        {
            var serviceHost = reader.GetServiceHost(id);

            ViewBag.Trail = serviceHost.GetTrail();
            if (!serviceHost.UserHasAccessTo())
            {
                throw new UnauthorizedAccessException("Access denied to configset");
            }
            ViewBag.HostId = serviceHost.Id;
            return(View((object)null));
        }
Exemple #2
0
        public ActionResult SetProperty(string id, string properyMessage)
        {
            Logging.DebugMessage("AuthenticatedUser: {0}", this.HttpContext.User.Identity.Name);
            if (!this.HttpContext.User.Identity.IsAuthenticated)
            {
                throw new UnauthorizedAccessException("Access denied");
            }
            this.id = id;
            try
            {
                var settings = GetData <PropertyRequest>(properyMessage);
                var env      = environmentTasks.GetEnvironment(string.Format("{0}-{1}", id, settings.Environment));
                switch (settings.Type)
                {
                case VariableTypes.Environmental:
                    SetEnvironmentVariable(env, settings.PropertyName, settings.Value, settings.IsSecure);
                    break;

                case VariableTypes.ServiceHost:
                case VariableTypes.ServiceHostEnvironmental:
                    var host = configSetTasks.GetServiceHost(string.Format("{0}-{1}", id, settings.ParentContainer));
                    SetHostParameter(configSetTasks, settings, host);
                    if (settings.Type == VariableTypes.ServiceHostEnvironmental)
                    {
                        var envKey = GetEnvironmentSubstitutionKey(settings);
                        SetEnvironmentSubstitutionVariable(env, envKey, settings.Value, settings.IsSecure, settings.Description);
                    }
                    break;

                case VariableTypes.Service:
                case VariableTypes.ServiceEnvironmental:
                    SetEnpointParameter(settings);
                    if (settings.Type == VariableTypes.ServiceHostEnvironmental)
                    {
                        var envKey = GetEnvironmentSubstitutionKey(settings);
                        SetEnvironmentSubstitutionVariable(env, envKey, settings.Value, settings.IsSecure, settings.Description);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ex.Log();
                return(new HttpStatusCodeResult(500, ex.Message));
            }
            return(new HttpStatusCodeResult(200, "OK"));
        }
Exemple #3
0
        public HttpResponseMessage SetProperty(string id, [FromBody] PropertyRequest properyMessage)
        {
            Logging.DebugMessage("AuthenticatedUser: {0}", this.User.Identity.Name);
            if (!this.User.Identity.IsAuthenticated)
            {
                throw new UnauthorizedAccessException("Access denied");
            }
            this.id = id;
            try
            {
                var settings = properyMessage;
                var env      = environmentTasks.GetEnvironment(string.Format("{0}-{1}", id, settings.Environment));
                switch (settings.Type)
                {
                case VariableTypes.Environmental:
                    SetEnvironmentVariable(env, settings.PropertyName, settings.Value, settings.IsSecure);
                    break;

                case VariableTypes.ServiceHost:
                case VariableTypes.ServiceHostEnvironmental:
                    var host = configSetTasks.GetServiceHost(string.Format("{0}-{1}", id, settings.ParentContainer));
                    SetHostParameter(configSetTasks, settings, host);
                    if (settings.Type == VariableTypes.ServiceHostEnvironmental)
                    {
                        var envKey = GetEnvironmentSubstitutionKey(settings);
                        SetEnvironmentSubstitutionVariable(env, envKey, settings.Value, settings.IsSecure);
                    }
                    break;

                case VariableTypes.Service:
                case VariableTypes.ServiceEnvironmental:
                    SetEnpointParameter(settings);
                    if (settings.Type == VariableTypes.ServiceHostEnvironmental)
                    {
                        var envKey = GetEnvironmentSubstitutionKey(settings);
                        SetEnvironmentSubstitutionVariable(env, envKey, settings.Value, settings.IsSecure);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ex.Log();
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, string.Format("Error: {0}", ex.Message)));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, "OK"));
        }
Exemple #4
0
        public ActionResult Details(string id)
        {
            var serviceHost = reader.GetServiceHost(id);

            ViewBag.Trail = serviceHost.GetTrail();
            if (!serviceHost.UserHasAccessTo())
            {
                throw new UnauthorizedAccessException("Access denied to configset");
            }
            ViewBag.Name   = serviceHost.ConfigSet.Name;
            ViewBag.System = serviceHost.ConfigSet.System;
            ViewBag.HostId = serviceHost.Id;
            if (serviceHost.Visualization.IsNullOrWhiteSpace())
            {
                serviceHost.Visualization = "ellipse";
            }
            ViewBag.Visializations = new List <string> {
                "ellipse", "circle", "database", "box"
            };
            CreateLayerSelectList(serviceHost);
            return(View(serviceHost));
        }