// GET: Deployments/RunExecute //[FrameworkAuthorization] public ActionResult RunExecute(string name, string stepAction, int stepId) { if (name == null) { ViewBag.Message = "Invalid name. Nothing to display."; //return View(); Redirect, because RunExecute View does not exist return(RedirectToAction("Execute")); } //ToDo: Check if deployment is verified but allow to execute after additional confirmation using (var service = DomainLocator.GetRepositoryService()) { //Get deployment and its steps. var converter = new Converter(); var deploymentBO = service.Object.ReadDeployment(name); var runDeployment = new RunDeployment { Deployment = converter.Convert(deploymentBO) }; var deploymentSteps = service.Object.ReadDeploymentSteps(name); switch (stepAction) { case "startdeployment": //Set steps' status to init and ... foreach (var deploymentStep in deploymentSteps) { deploymentStep.StepState = BO.DeploymentStepState.Init; service.Object.CreateDeploymentStep(name, deploymentStep); runDeployment.DeploymentSteps.Add(converter.Convert(deploymentStep)); //... the first step's to active only if the list is not empty runDeployment.DeploymentSteps[0].StepState = DeploymentStepState.Active; } //Set deployment's status to active when deployment starts... deploymentBO.Status = BO.DeploymentStatus.Active; service.Object.CreateDeployment(deploymentBO); runDeployment.Deployment.Status = DeploymentStatus.Active; break; //... and change the status of a steps with stepId and matching stepAction case "complete": deploymentSteps.Single(s => s.Id == stepId).StepState = BO.DeploymentStepState.Successful; service.Object.CreateDeploymentStep(name, deploymentSteps.Single(s => s.Id == stepId)); break; case "skip": deploymentSteps.Single(s => s.Id == stepId).StepState = BO.DeploymentStepState.Skipped; service.Object.CreateDeploymentStep(name, deploymentSteps.Single(s => s.Id == stepId)); break; case "failed": deploymentSteps.Single(s => s.Id == stepId).StepState = BO.DeploymentStepState.Failed; service.Object.CreateDeploymentStep(name, deploymentSteps.Single(s => s.Id == stepId)); break; } } return(RedirectToAction("Execute", new { name })); }
// GET: Deployments/Delete //[FrameworkAuthorization] public ActionResult Delete(string name) { ViewBag.Message = "You are about to delete:"; if (name == null) { ViewBag.Message = "Invalid name. Nothing to display."; return(View()); } Deployment deployment = null; using (var service = DomainLocator.GetRepositoryService()) { var deployments = service.Object.ReadDeployments(); foreach (var deploymentBO in deployments) { if (deploymentBO.Name != name) { continue; } var converter = new Converter(); deployment = converter.Convert(deploymentBO); } } if (deployment == null) { return(HttpNotFound()); } return(View(deployment)); }
// GET: Deployments/Edit //[FrameworkAuthorization] public ActionResult Edit(string name) { if (name == null) { ViewBag.Message = "Invalid name. Nothing to display."; return(View()); } var deployment = new Deployment(); using (var service = DomainLocator.GetRepositoryService()) { var deployments = service.Object.ReadDeployments(); foreach (var deploymentBO in deployments) { if (deploymentBO.Name != name) { continue; } var converter = new Converter(); deployment = converter.Convert(deploymentBO); deployment.ReleaseVersions = new SelectList(service.Object.ReadReleaseVersions()); var configData = service.Object.ReadConfiguration("MainConfiguration"); deployment.Environments = new SelectList(converter.Convert(configData).DeployEnvironments); break; } } return(View(deployment)); }
public IRelease Convert(Release release) { using (var convertedRelease = DomainLocator.GetRelease()) { convertedRelease.Object.Version = release.Version; convertedRelease.Object.Description = release.Description; convertedRelease.Object.DueDate = release.DueDate; foreach (var releaseUnit in release.UnitList) { using (var convertedReleaseUnit = DomainLocator.GetReleaseUnit()) { convertedReleaseUnit.Object.Name = releaseUnit.Name; foreach (var stakeholder in releaseUnit.StakeholderList) { convertedReleaseUnit.Object.StakeholderList.Add(Convert(stakeholder)); } foreach (var releaseElement in releaseUnit.ReleaseElementsList) { convertedReleaseUnit.Object.ReleaseElementList.Add(Convert(releaseElement)); } convertedRelease.Object.UnitList.Add(convertedReleaseUnit.Object); } } return(convertedRelease.Object); } }
// GET: Deployments/Execute //[FrameworkAuthorization] public ActionResult Execute(string name) { if (name == null) { ViewBag.Message = "Invalid name. Nothing to display."; return(View()); } var runDeployment = new RunDeployment(); using (var service = DomainLocator.GetRepositoryService()) { var deploymentBO = service.Object.ReadDeployment(name); var converter = new Converter(); runDeployment.Deployment = converter.Convert(deploymentBO); if (runDeployment.Deployment.Status == DeploymentStatus.Active) { var deploymentSteps = service.Object.ReadDeploymentSteps(name); var steps = deploymentSteps as BO.IDeploymentStep[] ?? deploymentSteps.ToArray(); if (steps.Any()) { if (steps.Last().StepState != Domain.Shared.DeploymentStepState.Init && steps.Last().StepState != Domain.Shared.DeploymentStepState.Active) { runDeployment.Deployment.Status = DeploymentStatus.Failed; foreach (var deploymentStep in steps) { if (deploymentStep.StepState != Domain.Shared.DeploymentStepState.Failed) { runDeployment.Deployment.Status = DeploymentStatus.Successful; } } service.Object.CreateDeployment(converter.Convert(runDeployment.Deployment)); return(RedirectToAction("Index")); } foreach (var deploymentStep in steps) { runDeployment.DeploymentSteps.Add(converter.Convert(deploymentStep)); } } else { runDeployment.DeploymentSteps.Add( new DeploymentStep() { Id = 1, Description = "No steps available", StepState = DeploymentStepState.Active } ); } } } return(View(runDeployment)); }
public IReleaseElement Convert(ReleaseElement releaseElement) { using (var convertedReleaseElement = DomainLocator.GetReleaseElement()) { convertedReleaseElement.Object.SelectListPrefix = releaseElement.SelectListPrefix; convertedReleaseElement.Object.Content = releaseElement.Content; return(convertedReleaseElement.Object); } }
private void RunInitializeCheck() { using (var service = DomainLocator.GetRepositoryService()) { var configuration = new WEB.Configuration(); var converter = new Converter(); service.Object.CreateConfiguration("MainConfiguration", converter.Convert(configuration)); } }
public IVerificationMessage Convert(VerificationMessage verificationMessage) { using (var convertedMessage = DomainLocator.GetVerificationMessage()) { convertedMessage.Object.MessageContent = verificationMessage.MessageContent; convertedMessage.Object.Status = (BO.VerificationStatus)verificationMessage.Status; return(convertedMessage.Object); } }
public IStakeholder Convert(Stakeholder stakeholder) { using (var convertedStakeholder = DomainLocator.GetStakeholder()) { convertedStakeholder.Object.Name = stakeholder.Name; convertedStakeholder.Object.IsParticipating = stakeholder.IsParticipating; return(convertedStakeholder.Object); } }
private List <Stakeholder> GetStakeholdersHeadline() { using (var service = DomainLocator.GetRepositoryService()) { var stakeholderList = new List <Stakeholder>(); var configData = service.Object.ReadConfiguration("MainConfiguration"); //Needed only to display all available stakeholders var converter = new Converter(); return(stakeholderList = converter.Convert(configData).Stakeholders); } }
public IDeploymentStep Convert(DeploymentStep deploymentStep) { using (var convertedDeploymentStep = DomainLocator.GetDeploymentStep()) { convertedDeploymentStep.Object.Id = deploymentStep.Id; convertedDeploymentStep.Object.Description = deploymentStep.Description; convertedDeploymentStep.Object.StepState = (BO.DeploymentStepState)deploymentStep.StepState; convertedDeploymentStep.Object.Comment = deploymentStep.Comment; return(convertedDeploymentStep.Object); } }
// GET: Releases //[FrameworkAuthorization] public ActionResult Index() { RunInitializeCheck(); var indexReleaseList = new List <Release>(); using (var service = DomainLocator.GetRepositoryService()) { var releases = service.Object.ReadReleases(); indexReleaseList.AddRange(from releaseBO in releases let converter = new Converter() select converter.Convert(releaseBO)); } return(View(indexReleaseList)); }
//public Release Convert(IRelease releaseBO, List<Stakeholder> stakeholderWEB) //{ // var convertedRelease = new Release(); // convertedRelease.Version = releaseBO.Version; // convertedRelease.Description = releaseBO.Description; // convertedRelease.DueDate = releaseBO.DueDate; // foreach (var releaseunitBO in releaseBO.UnitList) // { // var convertedReleaseUnit = new ReleaseUnit(); // convertedReleaseUnit.Name = releaseunitBO.Name; // foreach (var stakeholderBO in releaseunitBO.StakeholderList) // { // convertedReleaseUnit.StakeholderList.Add(Convert(stakeholderBO)); // } // convertedRelease.UnitList.Add(convertedReleaseUnit); // } // return convertedRelease; //} #endregion Release #region Deployment public IDeployment Convert(Deployment deployment) { using (var convertedDeployment = DomainLocator.GetDeployment()) { convertedDeployment.Object.Name = deployment.Name; convertedDeployment.Object.Description = deployment.Description; convertedDeployment.Object.DueDate = deployment.DueDate; convertedDeployment.Object.ReleaseVersion = deployment.ReleaseVersion; convertedDeployment.Object.Environment = deployment.Environment; convertedDeployment.Object.Status = (BO.DeploymentStatus)deployment.Status; return(convertedDeployment.Object); } }
//[FrameworkAuthorization] //[ValidateAntiForgeryToken] public ActionResult Delete(ReleaseCombined releaseCombined, string action) { if (action == "delete") { using (var service = DomainLocator.GetRepositoryService()) { var converter = new Converter(); service.Object.DeleteRelease(converter.Convert(releaseCombined.Release)); return(RedirectToAction("Index")); } } return(View()); }
// GET: Deployment //[FrameworkAuthorization] public ActionResult Index() { RunInitializeCheck(); var indexDeploymentList = new List <Deployment>(); using (var service = DomainLocator.GetRepositoryService()) { var deployments = service.Object.ReadDeployments(); indexDeploymentList.AddRange(from deploymentBO in deployments let converter = new Converter() select converter.Convert(deploymentBO)); } return(View(indexDeploymentList)); }
//[FrameworkAuthorization] //[ValidateAntiForgeryToken] public ActionResult Delete(Deployment deployment, string action) { if (action != "delete") { return(View()); } using (var service = DomainLocator.GetRepositoryService()) { var converter = new Converter(); service.Object.DeleteDeployment(converter.Convert(deployment)); return(RedirectToAction("Index")); } }
//[FrameworkAuthorization] //[ValidateAntiForgeryToken] public ActionResult Create(Deployment deployment, string action) { switch (action) { case "save": if (ModelState.IsValid) { using (var service = DomainLocator.GetRepositoryService()) { var converter = new Converter(); service.Object.CreateDeployment(converter.Convert(deployment)); } return(RedirectToAction("Index")); } break; //case "verify": // using (var service = DomainLocator.GetVerificationService()) // { // var converter = new Converter(); // using (var repoService = DomainLocator.GetRepositoryService()) // { // deployment.ReleaseVersions = new SelectList(repoService.Object.ReadReleaseVersions()); // var configData = repoService.Object.ReadConfiguration("MainConfiguration"); // deployment.Environments = new SelectList(converter.Convert(configData).DeployEnvironments); // var verifiedMessages = service.Object.Verify(converter.Convert(deployment), "okwarn"); // deployment.Status = DeploymentStatus.Verified; // foreach (var message in verifiedMessages) // { // deployment.VerificationMessages.Add(converter.Convert(message)); // if (message.Status != BO.VerificationStatus.OK) // { // deployment.Status = DeploymentStatus.Init; // } // } // } // } // return View(deployment); } using (var repoService = DomainLocator.GetRepositoryService()) { deployment.ReleaseVersions = new SelectList(repoService.Object.ReadReleaseVersions()); var configData = repoService.Object.ReadConfiguration("MainConfiguration"); var converter = new Converter(); deployment.Environments = new SelectList(converter.Convert(configData).DeployEnvironments); deployment.Status = DeploymentStatus.Init; return(View(deployment)); } }
// GET: Deployments/Create //[FrameworkAuthorization] public ActionResult Create(string name) { var deployment = new Deployment { Name = name }; using (var service = DomainLocator.GetRepositoryService()) { deployment.ReleaseVersions = new SelectList(service.Object.ReadReleaseVersions()); var configData = service.Object.ReadConfiguration("MainConfiguration"); var converter = new Converter(); deployment.Environments = new SelectList(converter.Convert(configData).DeployEnvironments); } return(View(deployment)); }
// GET: Releases/Prepare //[FrameworkAuthorization] public ActionResult Prepare(string version) { if (version == null) { ViewBag.Message = "Invalid version number. Nothing to display."; return(View()); } ReleasePrepared releasePrepared = new ReleasePrepared { StakeholdersHeadline = GetStakeholdersHeadline() }; using (var service = DomainLocator.GetRepositoryService()) { //ToDo: Change to ReadReleaseVersions() and then Read() one Release var releases = service.Object.ReadReleases(); foreach (var releaseBO in releases) { if (releaseBO.Version != version) { continue; } var converter = new Converter(); releasePrepared.Release = converter.Convert(releaseBO); foreach (var releaseUnit in releasePrepared.Release.UnitList) { foreach (var headline in releasePrepared.StakeholdersHeadline) { if (releaseUnit.StakeholderList.Count(x => x.Name == headline.Name) > 0) { continue; } releaseUnit.StakeholderList.Add(headline); } } } } //Create SelectList var participatingStakeholdersUnits = (from releaseUnit in releasePrepared.Release.UnitList from stakeholder in releaseUnit.StakeholderList where stakeholder.IsParticipating select string.Format("{0}~{1}~", releaseUnit.Name, stakeholder.Name)).ToList(); releasePrepared.ReleaseElementOptions = new SelectList(participatingStakeholdersUnits, "Select release unit and team"); return(View(releasePrepared)); }
public override void OnAuthorization(AuthorizationContext filterContext) { base.OnAuthorization(filterContext); using (var authorizationService = DomainLocator.GetAuthorizationService()) { var authorized = authorizationService.Object.IsAuthorized(filterContext.HttpContext.User); if (!authorized) { filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary { { "action", "Unauthorized" }, { "controller", "Home" } }); } } }
//[FrameworkAuthorization] //[ValidateAntiForgeryToken] public ActionResult Prepare(ReleasePrepared releasePrepared, string action) { releasePrepared.StakeholdersHeadline = GetStakeholdersHeadline(); switch (action) { case "addreleaseelement": //ToDo: Add list of Release Elements in Domain.Release and add Release Elements here var releaseElement = new ReleaseElement { SelectListPrefix = releasePrepared.ReleaseElementOption, Content = releasePrepared.NewReleaseElement }; //ToDo: catch NullReferenceExeption releasePrepared.Release.UnitList.FirstOrDefault( x => x.Name == releasePrepared.ReleaseElementOption.Split('~')[0]). ReleaseElementsList.Add(releaseElement); //Create SelectList anew var participatingStakeholdersUnits = (from releaseUnit in releasePrepared.Release.UnitList from stakeholder in releaseUnit.StakeholderList where stakeholder.IsParticipating select string.Format("{0}~{1}~", releaseUnit.Name, stakeholder.Name)).ToList(); releasePrepared.ReleaseElementOptions = new SelectList(participatingStakeholdersUnits, "Select release unit and team"); break; case "save": if (ModelState.IsValid) { using (var service = DomainLocator.GetRepositoryService()) { var converter = new Converter(); service.Object.CreateRelease(converter.Convert(releasePrepared.Release)); return(RedirectToAction("Index")); } } break; case "confirmprepare": //ToDo: Add field Status in ??? and set Status here break; } return(View(releasePrepared)); }
public IConfiguration Convert(Configuration configuration) { using (var convertedConfiguration = DomainLocator.GetConfiguration()) { foreach (var stakeholder in configuration.Stakeholders) { convertedConfiguration.Object.Stakeholders.Add(Convert(stakeholder)); } foreach (var environment in configuration.DeployEnvironments) { convertedConfiguration.Object.DeployEnvironments.Add(environment); } foreach (var initFolder in configuration.InitFolders) { convertedConfiguration.Object.DeployEnvironments.Add(initFolder); } return(convertedConfiguration.Object); } }
private void AddTrustedDomains(LiveDataStorage storage) { storage.KnownDomains.Clear(); List <DataStorageDomainTrusts> domains; List <SecurityIdentifier> KnownSID = new List <SecurityIdentifier>(); domains = GetAllDomainTrusts(Server); storage.KnownDomains.AddRange(domains); KnownSID.AddRange(domains.ConvertAll(x => x.DomainSid)); var domainLocator = new DomainLocator(Server); foreach (var node in storage.nodes.Values) { if (!String.IsNullOrEmpty(node.Sid) && node.Sid.StartsWith("S-1-5-21-") && node.Shortname.Contains("\\")) { var sid = new SecurityIdentifier(node.Sid); var domainSid = sid.AccountDomainSid; if (!KnownSID.Contains(domainSid)) { string domainName; string forestName; string NetbiosName = node.Shortname.Split('\\')[0]; if (domainLocator.LocateDomainFromNetbios(NetbiosName, out domainName, out forestName)) { KnownSID.Add(domainSid); storage.KnownDomains.Add(new DataStorageDomainTrusts() { DnsDomainName = domainName, DomainSid = domainSid, NetbiosDomainName = NetbiosName, } ); } } } } }
// GET: Releases/Delete //[FrameworkAuthorization] public ActionResult Delete(string version) { ViewBag.Message = "You are about to delete:"; if (version == null) { ViewBag.Message = "Invalid version number. Nothing to display."; return(View()); } ReleaseCombined releaseCombined = new ReleaseCombined { StakeholdersHeadline = GetStakeholdersHeadline() }; using (var service = DomainLocator.GetRepositoryService()) { var releases = service.Object.ReadReleases(); foreach (var releaseBO in releases) { if (releaseBO.Version != version) { continue; } var converter = new Converter(); releaseCombined.Release = converter.Convert(releaseBO); foreach (var releaseUnit in releaseCombined.Release.UnitList) { foreach (var headline in releaseCombined.StakeholdersHeadline) { if (releaseUnit.StakeholderList.Count(x => x.Name == headline.Name) > 0) { continue; } releaseUnit.StakeholderList.Add(headline); } } } } return(View(releaseCombined)); }
//[FrameworkAuthorization] //[ValidateAntiForgeryToken] public ActionResult Create(ReleaseCombined releaseCombined, string action) { releaseCombined.StakeholdersHeadline = GetStakeholdersHeadline(); switch (action) { case "addreleaseunit": var releaseUnit = new ReleaseUnit { Name = releaseCombined.NewReleaseUnit }; foreach (var stakeholderHead in releaseCombined.StakeholdersHeadline) { releaseUnit.StakeholderList.Add(new Stakeholder() { Name = stakeholderHead.Name, IsParticipating = false }); } releaseCombined.Release.UnitList.Add(releaseUnit); break; case "save": if (ModelState.IsValid) { using (var service = DomainLocator.GetRepositoryService()) { var converter = new Converter(); service.Object.CreateRelease(converter.Convert(releaseCombined.Release)); } return(RedirectToAction("Index")); } break; case "deletereleaseunit": //ToDo: Complete view and logic break; } return(View(releaseCombined)); }