Updates user and user group editors security policies

This commit is contained in:
Shannon
2017-08-22 16:09:06 +10:00
parent 8033c6807f
commit 5afe16ae0e
7 changed files with 190 additions and 36 deletions

View File

@@ -3,7 +3,9 @@ using AutoMapper;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using System.Linq;
using Umbraco.Core.Models;
using Umbraco.Web.Trees;
using Section = Umbraco.Web.Models.ContentEditing.Section;
namespace Umbraco.Web.Editors
{
@@ -54,11 +56,19 @@ namespace Umbraco.Web.Editors
return sectionModels;
}
/// <summary>
/// Returns all the sections that the user has access to
/// </summary>
/// <returns></returns>
public IEnumerable<Section> GetAllSections()
{
var sections = Services.SectionService.GetSections();
return sections.Select(Mapper.Map<Core.Models.Section, Section>);
var mapped = sections.Select(Mapper.Map<Core.Models.Section, Section>);
if (Security.CurrentUser.IsAdmin())
return mapped;
return mapped.Where(x => Security.CurrentUser.AllowedSections.Contains(x.Alias)).ToArray();
}
}