using System.Web.Security; using Umbraco.Core; using Umbraco.Core.Composing; using Umbraco.Core.Events; using Umbraco.Core.Scoping; using Umbraco.Core.Services; using Umbraco.Core.Services.Implement; using System.Linq; using System; using Umbraco.Core.Security; using Umbraco.Web.Editors; using Umbraco.Web; using Umbraco.Web.Dashboards; using Umbraco.Web.PublishedModels; namespace MySite.Custom { [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public class CustomEventComposer : ComponentComposer { } public class CustomEventComponent : IComponent { public void Initialize() { EditorModelEventManager.SendingContentModel += EditorModelEventManager_SendingContentModel; } private void EditorModelEventManager_SendingContentModel(System.Web.Http.Filters.HttpActionExecutedContext sender, EditorModelEventArgs e) { var identity = (UmbracoBackOfficeIdentity)System.Web.HttpContext.Current.User.Identity; var currentUSer = Current.Services.UserService.GetByProviderKey(identity.Id); if (!currentUSer.Groups.Any(x => x.Alias == "admin")) { foreach (var variant in e.Model.Variants) variant.Tabs = variant.Tabs.Where(x => x.Label != "Admin"); } } public void Terminate() { } } }