Fixes: U4-2800 ContentPostValidate apparently doesn't work - need to look into it

This commit is contained in:
Shannon
2013-09-21 12:29:53 +10:00
parent a065874421
commit f30bac2919
2 changed files with 12 additions and 11 deletions

View File

@@ -417,7 +417,7 @@ namespace Umbraco.Web.Editors
/// <param name="contentService"></param>
/// <param name="nodeId">The content to lookup, if the contentItem is not specified</param>
/// <param name="permissionToCheck"></param>
/// <param name="contentItem">Specifies the already resolved content item to check against, setting this ignores the nodeId</param>
/// <param name="contentItem">Specifies the already resolved content item to check against</param>
/// <returns></returns>
internal static bool CheckPermissions(
IDictionary<string, object> storage,

View File

@@ -310,21 +310,22 @@ namespace Umbraco.Web.Editors
/// <returns></returns>
internal static bool CheckPermissions(IDictionary<string, object> 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;
}