Updates user and user group editors security policies
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user