2021-04-01 21:30:29 +04:00
|
|
|
|
using DesktopTools.Interfaces;
|
2021-03-28 19:48:15 +04:00
|
|
|
|
using DesktopTools.Models;
|
2022-03-18 22:38:52 +04:00
|
|
|
|
using ToolsModule.BindingModels;
|
|
|
|
|
using ToolsModule.BusinessLogics;
|
|
|
|
|
using ToolsModule.Enums;
|
|
|
|
|
using ToolsModule.Interfaces;
|
|
|
|
|
using ToolsModule.Models;
|
2021-04-02 15:53:15 +04:00
|
|
|
|
using SecurityWindowsDesktop.EntityControls;
|
|
|
|
|
using SecurityWindowsDesktop.SpecialControls;
|
2021-03-27 23:50:29 +04:00
|
|
|
|
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-04-01 21:30:29 +04:00
|
|
|
|
if (!manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserIdForAccess = 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>
|
|
|
|
|
{
|
2021-04-01 21:30:29 +04:00
|
|
|
|
new WindowDesktopExtensionControlModel { Title = "Администрирование" }
|
2021-03-27 23:50:29 +04:00
|
|
|
|
};
|
2021-04-01 21:30:29 +04:00
|
|
|
|
List<IControl> _controls = new()
|
2021-03-27 23:50:29 +04:00
|
|
|
|
{
|
2021-04-01 21:30:29 +04:00
|
|
|
|
new ControlUserList(),
|
|
|
|
|
new ControlRoleList(),
|
|
|
|
|
new ControlAccessList(),
|
|
|
|
|
new ControlEnviromentSettingList()
|
2021-03-27 23:50:29 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach (var cntrl in _controls)
|
|
|
|
|
{
|
2021-04-01 21:30:29 +04:00
|
|
|
|
if (manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserIdForAccess = 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
|
|
|
|
|
{
|
2021-03-29 23:16:11 +04:00
|
|
|
|
Id = cntrl.ControlId,
|
2021-03-27 23:50:29 +04:00
|
|
|
|
Title = cntrl.Title,
|
|
|
|
|
Control = cntrl
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
2021-04-02 15:53:15 +04:00
|
|
|
|
|
|
|
|
|
public List<WindowDesktopExtensionControlModel> GetListControlSpecialList()
|
|
|
|
|
{
|
|
|
|
|
var manager = DependencyManager.Instance.Resolve<ISecurityManager>();
|
|
|
|
|
if (manager == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserIdForAccess = manager.User },
|
|
|
|
|
AccessOperation.Администрирование, AccessType.View, "Администрирование")))
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = new List<WindowDesktopExtensionControlModel>
|
|
|
|
|
{
|
|
|
|
|
new WindowDesktopExtensionControlModel { Title = "Администрирование" }
|
|
|
|
|
};
|
|
|
|
|
List<IControl> _controls = new()
|
|
|
|
|
{
|
2021-04-02 20:46:41 +04:00
|
|
|
|
new BackupControl(),
|
|
|
|
|
new SynchronizationControl()
|
2021-04-02 15:53:15 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach (var cntrl in _controls)
|
|
|
|
|
{
|
|
|
|
|
if (manager.CheckAccess(new SecurityManagerCheckAccessModel(new AccessBindingModel { UserIdForAccess = manager.User },
|
|
|
|
|
cntrl.AccessOperation, AccessType.View, cntrl.Title)))
|
|
|
|
|
{
|
|
|
|
|
list.Add(new WindowDesktopExtensionControlModel
|
|
|
|
|
{
|
|
|
|
|
Id = cntrl.ControlId,
|
|
|
|
|
Title = cntrl.Title,
|
|
|
|
|
Control = cntrl
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
2021-03-27 23:50:29 +04:00
|
|
|
|
}
|
|
|
|
|
}
|