From f30bac291989517c581d1fd8b5e6dfd483418afb Mon Sep 17 00:00:00 2001 From: Shannon Date: Sat, 21 Sep 2013 12:29:53 +1000 Subject: [PATCH] Fixes: U4-2800 ContentPostValidate apparently doesn't work - need to look into it --- src/Umbraco.Web/Editors/ContentController.cs | 2 +- src/Umbraco.Web/Editors/MediaController.cs | 21 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index c13840ea44..354134d78a 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -417,7 +417,7 @@ namespace Umbraco.Web.Editors /// /// The content to lookup, if the contentItem is not specified /// - /// Specifies the already resolved content item to check against, setting this ignores the nodeId + /// Specifies the already resolved content item to check against /// internal static bool CheckPermissions( IDictionary storage, diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index fef0d4716d..d1e72831ad 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -310,21 +310,22 @@ namespace Umbraco.Web.Editors /// internal static bool CheckPermissions(IDictionary storage, IUser user, IMediaService mediaService, int nodeId, IMedia media = null) { - if (nodeId != Constants.System.Root) + if (media == null && nodeId != Constants.System.Root) { - - - var contentItem = mediaService.GetById(nodeId); - if (contentItem == null) + media = mediaService.GetById(nodeId); + //put the content item into storage so it can be retreived + // in the controller (saves a lookup) + storage[typeof(IMedia).ToString()] = media; + } + + if (media == null && nodeId != Constants.System.Root) { throw new HttpResponseException(HttpStatusCode.NotFound); } - //put the content item into storage so it can be retreived - // in the controller (saves a lookup) - storage.Add(typeof(IMedia).ToString(), contentItem); - - var hasPathAccess = user.HasPathAccess(contentItem); + var hasPathAccess = (nodeId == Constants.System.Root) + ? UserExtensions.HasPathAccess("-1", user.StartMediaId, Constants.System.RecycleBinMedia) + : user.HasPathAccess(media); return hasPathAccess; }