mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 18:27:55 +08:00
Adding permission check when updloading media from the admin
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Dynamic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
@@ -27,6 +26,16 @@ namespace Orchard.MediaLibrary.Controllers {
|
|||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
|
|
||||||
public ActionResult Index(string folderPath, string type) {
|
public ActionResult Index(string folderPath, string type) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.ManageOwnMedia)) {
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check permission.
|
||||||
|
var rootMediaFolder = _mediaLibraryService.GetRootMediaFolder();
|
||||||
|
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.ManageMediaContent) && !_mediaLibraryService.CanManageMediaFolder(folderPath)) {
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
}
|
||||||
|
|
||||||
var viewModel = new ImportMediaViewModel {
|
var viewModel = new ImportMediaViewModel {
|
||||||
FolderPath = folderPath,
|
FolderPath = folderPath,
|
||||||
|
Reference in New Issue
Block a user