using DesktopTools.Controls; using ModelTools.BindingModels; using ModelTools.BusinessLogics; using ModelTools.Enums; using ModelTools.Interfaces; using ModelTools.Models; using SecurityBusinessLogic.BusinessLogics; using SecurityWindowsDesktop.Controls; using System.Collections.Generic; namespace SecurityWindowsDesktop { public class SecurityWindowDesktopExtension : IWindowDesktopExtension { public List GetListControlEntityList() { var manager = UnityContainerConfigurator.Resolve(); if (manager == null) { return null; } if (!manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserId = UserManager.GetInstance.UserId }, AccessOperation.Администрирование, AccessType.SimpleView, "Администрирование"))) { return null; } var list = new List { new WindowDesktopExtensionControlModel { Order = 0, Title = "Администрирование" } }; List _controls = new() { new UsersControl(), new RolesControl(), new AccessesControl(), new EnviromentSettingControl() }; foreach (var cntrl in _controls) { if (manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserId = UserManager.GetInstance.UserId }, cntrl.AccessOperation, AccessType.SimpleView, cntrl.Title))) { list.Add(new WindowDesktopExtensionControlModel { Id = cntrl.Id, Order = cntrl.Order, Title = cntrl.Title, Control = cntrl }); } } return list; } } }