2021-03-27 23:50:29 +04:00
|
|
|
|
using DesktopTools.Controls;
|
2021-03-28 19:48:15 +04:00
|
|
|
|
using DesktopTools.Interfaces;
|
|
|
|
|
using DesktopTools.Models;
|
2021-03-28 19:15:55 +04:00
|
|
|
|
using ModuleTools.BindingModels;
|
|
|
|
|
using ModuleTools.BusinessLogics;
|
|
|
|
|
using ModuleTools.Enums;
|
|
|
|
|
using ModuleTools.Interfaces;
|
|
|
|
|
using ModuleTools.Models;
|
2021-03-27 23:50:29 +04:00
|
|
|
|
using SecurityWindowsDesktop.Controls;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace SecurityWindowsDesktop
|
|
|
|
|
{
|
|
|
|
|
public class SecurityWindowDesktopExtension : IWindowDesktopExtension
|
|
|
|
|
{
|
|
|
|
|
public List<WindowDesktopExtensionControlModel> GetListControlEntityList()
|
|
|
|
|
{
|
2021-03-28 19:48:15 +04:00
|
|
|
|
var manager = DependencyManager.Instance.Resolve<ISecurityManager>();
|
2021-03-27 23:50:29 +04:00
|
|
|
|
if (manager == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-28 10:23:26 +04:00
|
|
|
|
if (!manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserId = manager.User },
|
2021-03-28 19:58:42 +04:00
|
|
|
|
AccessOperation.Администрирование, AccessType.View, "Администрирование")))
|
2021-03-27 23:50:29 +04:00
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = new List<WindowDesktopExtensionControlModel>
|
|
|
|
|
{
|
|
|
|
|
new WindowDesktopExtensionControlModel { Order = 0, Title = "Администрирование" }
|
|
|
|
|
};
|
2021-03-29 12:13:47 +04:00
|
|
|
|
List<BaseControlViewEntityList> _controls = new()
|
2021-03-27 23:50:29 +04:00
|
|
|
|
{
|
|
|
|
|
new UsersControl(),
|
|
|
|
|
new RolesControl(),
|
|
|
|
|
new AccessesControl(),
|
|
|
|
|
new EnviromentSettingControl()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach (var cntrl in _controls)
|
|
|
|
|
{
|
2021-03-28 10:23:26 +04:00
|
|
|
|
if (manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserId = manager.User },
|
2021-03-28 19:58:42 +04:00
|
|
|
|
cntrl.AccessOperation, AccessType.View, cntrl.Title)))
|
2021-03-27 23:50:29 +04:00
|
|
|
|
{
|
|
|
|
|
list.Add(new WindowDesktopExtensionControlModel
|
|
|
|
|
{
|
|
|
|
|
Id = cntrl.Id,
|
|
|
|
|
Order = cntrl.Order,
|
|
|
|
|
Title = cntrl.Title,
|
|
|
|
|
Control = cntrl
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|