public ActionResult Create(string folderPath) { if (!Services.Authorizer.Authorize(Permissions.ManageMediaContent, T("Couldn't create media folder"))) return new HttpUnauthorizedResult(); var viewModel = new MediaManagerFolderCreateViewModel { Hierarchy = _mediaLibraryService.GetMediaFolders(folderPath), FolderPath = folderPath }; return View(viewModel); }
public ActionResult Create(int? id) { if (!Services.Authorizer.Authorize(Permissions.ManageMediaContent, T("Couldn't create media folder"))) return new HttpUnauthorizedResult(); var viewModel = new MediaManagerFolderCreateViewModel { Hierarchy = id.HasValue ? _mediaLibraryService.GetMediaFolderHierarchy(id.Value) : Enumerable.Empty<MediaFolder>(), ParentFolderId = id }; return View(viewModel); }
public ActionResult Create(string folderPath) { if (!Services.Authorizer.Authorize(Permissions.ManageOwnMedia, T("Couldn't create media folder"))) return new HttpUnauthorizedResult(); // If the user is trying to access a folder above his boundaries, redirect him to his home folder var rootMediaFolder = _mediaLibraryService.GetRootMediaFolder(); if (!Services.Authorizer.Authorize(Permissions.ManageMediaContent) && !_mediaLibraryService.CanManageMediaFolder(folderPath)) { return RedirectToAction("Create", new { folderPath = rootMediaFolder.MediaPath }); } var viewModel = new MediaManagerFolderCreateViewModel { Hierarchy = _mediaLibraryService.GetMediaFolders(folderPath), FolderPath = folderPath }; return View(viewModel); }
public ActionResult Create() { if (!Services.Authorizer.Authorize(Permissions.ManageMediaContent, T("Couldn't create media folder"))) return new HttpUnauthorizedResult(); var viewModel = new MediaManagerFolderCreateViewModel(); UpdateModel(viewModel); try { _mediaLibraryService.CreateFolder(viewModel.FolderPath, viewModel.Name); Services.Notifier.Information(T("Media folder created")); } catch (ArgumentException argumentException) { Services.Notifier.Error(T("Creating Folder failed: {0}", argumentException.Message)); Services.TransactionManager.Cancel(); return View(viewModel); } return RedirectToAction("Index", "Admin", new { area = "Orchard.MediaLibrary" }); }