Fixes: U4-6973 Given custom permissions user can create, but cannot save
This commit is contained in:
@@ -221,8 +221,16 @@ namespace Umbraco.Web.Models.Mapping
|
||||
}
|
||||
var svc = _userService.Value;
|
||||
|
||||
var permissions = svc.GetPermissions(UmbracoContext.Current.Security.CurrentUser, source.Id)
|
||||
.FirstOrDefault();
|
||||
var permissions = svc.GetPermissions(
|
||||
//TODO: This is certainly not ideal usage here - perhaps the best way to deal with this in the future is
|
||||
// with the IUmbracoContextAccessor. In the meantime, if used outside of a web app this will throw a null
|
||||
// refrence exception :(
|
||||
UmbracoContext.Current.Security.CurrentUser,
|
||||
// Here we need to do a special check since this could be new content, in which case we need to get the permissions
|
||||
// from the parent, not the existing one otherwise permissions would be coming from the root since Id is 0.
|
||||
source.HasIdentity ? source.Id : source.ParentId)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (permissions == null)
|
||||
{
|
||||
return Enumerable.Empty<char>();
|
||||
|
||||
Reference in New Issue
Block a user