Ejemplo n.º 1
0
 public ClusterDTO(Cluster cluster, Dictionary<string, string> settings)
 {
     Cluster = cluster;
     Settings = settings;
 }
Ejemplo n.º 2
0
        public void AddRule(AccessRules rule)
        {
            var project = this.Projects.SingleOrDefault(x => x.Name == rule.Project);

            if (project == null)
            {
                project = new Project() { Name = rule.Project };

                this.Projects.Add(project);
            }

            var application = project.Applications.SingleOrDefault(x => x.Name == rule.Application);

            if (application == null)
            {
                application = new Application() { Name = rule.Application };

                project.Applications.Add(application);
            }

            if (rule.Cluster == "Defaults")
            {
                if (rule.Access == Access.WriteAccess)
                    application.Access = Access.ReadAcccess | Access.WriteAccess;
                else
                    application.Access = Access.ReadAcccess;
            }
            else
            {
                var cluster = application.Clusters.SingleOrDefault(x => x.Name == rule.Cluster);

                if (cluster == null)
                {
                    cluster = new Cluster() { Name = rule.Cluster };

                    application.Clusters.Add(cluster);
                }

                if (rule.Access == Access.WriteAccess)
                    cluster.Access = Access.ReadAcccess | Access.WriteAccess;
                else
                    cluster.Access = Access.ReadAcccess;
            }
        }
Ejemplo n.º 3
0
 public MachineDTO(string name, Cluster cluster, Dictionary<string, string> settings)
 {
     Name = name;
     Cluster = cluster;
     Settings = settings;
 }