97 lines
2.7 KiB
C#
97 lines
2.7 KiB
C#
using SecurityWindowsDesktop.EntityControls;
|
||
using SecurityWindowsDesktop.SpecialControls;
|
||
using System.Collections.Generic;
|
||
using ToolsDesktop.Interfaces;
|
||
using ToolsDesktop.Models;
|
||
using ToolsModule.ManagmentDependency;
|
||
using ToolsModule.ManagmentSecurity;
|
||
|
||
namespace SecurityWindowsDesktop
|
||
{
|
||
public class SecurityWindowDesktopExtension : IWindowDesktopExtension
|
||
{
|
||
public List<WindowDesktopExtensionControlModel> GetListControlEntityList()
|
||
{
|
||
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()
|
||
{
|
||
new ControlUserList(),
|
||
new ControlRoleList(),
|
||
new ControlAccessList(),
|
||
new ControlEnviromentSettingList()
|
||
};
|
||
|
||
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;
|
||
}
|
||
|
||
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()
|
||
{
|
||
new BackupControl(),
|
||
new SynchronizationControl()
|
||
};
|
||
|
||
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;
|
||
}
|
||
}
|
||
} |