public ActionResult RunPackageActions(string id, PackageInstallationState state) { var nugetPackage = BackOfficeRequestContext.PackageContext.LocalPackageManager.SourceRepository.FindPackage(id); //Run the configuration tasks //get the package with the name and ensure it exists if (nugetPackage != null) { //get the package folder name, create the task execution context and then execute the package tasks using the utility class var packageFolderName = BackOfficeRequestContext.PackageContext.LocalPathResolver.GetPackageDirectory(nugetPackage); var taskExeContext = _packageInstallUtility.GetTaskExecutionContext(nugetPackage, packageFolderName, state, this); _packageInstallUtility.RunPostPackageInstallActions(state, taskExeContext, packageFolderName); //re-issue authentication token incase any permissions have changed so that a re-login is not required. if (User.Identity is UmbracoBackOfficeIdentity) { var user = (UmbracoBackOfficeIdentity)User.Identity; var userId = user.Id; using (var uow = BackOfficeRequestContext.Application.Hive.OpenReader <ISecurityStore>()) { var entity = uow.Repositories.Get <User>(userId); HttpContext.CreateUmbracoAuthTicket(entity); } } } //if the task did not redirect, then show the LocalRepositoryr return(RedirectToAction("LocalRepository")); }
public ActionResult RunPackageActions(string id, PackageInstallationState state) { var nugetPackage = BackOfficeRequestContext.PackageContext.LocalPackageManager.SourceRepository.FindPackage(id); //Run the configuration tasks //get the package with the name and ensure it exists if (nugetPackage != null) { //get the package folder name, create the task execution context and then execute the package tasks using the utility class var packageFolderName = BackOfficeRequestContext.PackageContext.LocalPathResolver.GetPackageDirectory(nugetPackage); var taskExeContext = _packageInstallUtility.GetTaskExecutionContext(nugetPackage, packageFolderName, state, this); _packageInstallUtility.RunPostPackageInstallActions(state, taskExeContext, packageFolderName); //re-issue authentication token incase any permissions have changed so that a re-login is not required. if (User.Identity is RebelBackOfficeIdentity) { var userId = ((RebelBackOfficeIdentity)User.Identity).Id; var user = BackOfficeRequestContext.Application.Security.Users.GetById(userId, true); var userData = BackOfficeRequestContext.Application.FrameworkContext.TypeMappers.Map <UserData>(user); HttpContext.CreateRebelAuthTicket(userData); } switch (state) { case PackageInstallationState.Installing: Notifications.Add(new NotificationMessage(nugetPackage.Title + " has been installed", "Package installed", NotificationType.Success)); SuccessfulOnRedirectAttribute.EnsureRouteData(this, "id", nugetPackage.Id); return(RedirectToAction("Installed", new { id = nugetPackage.Id })); case PackageInstallationState.Uninstalling: Notifications.Add(new NotificationMessage(nugetPackage.Title + " has been uninstalled", "Package uninstalled", NotificationType.Success)); SuccessfulOnRedirectAttribute.EnsureRouteData(this, "id", nugetPackage.Id); return(RedirectToAction("Uninstalled")); } } //if the task did not redirect, then perform default redirects return(RedirectToAction("LocalRepository")); }
public JsonResult RunPackageActions(string id) { bool onlyCheck; if (!bool.TryParse(ValueProvider.GetValue("onlyCheck").AttemptedValue, out onlyCheck)) { throw new InvalidCastException("The required onlyCheck parameter is not found or was not recognized as boolean"); } if (!onlyCheck) { var nugetPackage = _requestContext.PackageContext.LocalPackageManager.SourceRepository.FindPackage(id); //Run the configuration taks //get the package with the name and ensure it exists if (nugetPackage != null) { var packageFolderName = _requestContext.PackageContext.LocalPathResolver.GetPackageDirectory(nugetPackage); //Run the post pacakge install tasks var taskExeContext = _packageInstallUtility.GetTaskExecutionContext(nugetPackage, packageFolderName, PackageInstallationState.Installing, this); _packageInstallUtility.RunPostPackageInstallActions(PackageInstallationState.Installing, taskExeContext, packageFolderName); } return(Json(new { status = "complete", message = "Installation completed!", percentage = 100 })); } return(Json(new { percentage = 40 })); }