DepartmentProject/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs

73 lines
2.0 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using DepartmentWindowsDesktop.EntityControls;
using System.Collections.Generic;
using ToolsDesktop.Interfaces;
using ToolsDesktop.Models;
using ToolsModule.ManagmentDependency;
using ToolsModule.ManagmentSecurity;
namespace DepartmentWindowsDesktop
{
public class DepartmentWindowDesktopExtension : 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 ControlPostList(),
new ControlEmployeeList(),
new ControlClassroomList(),
new ControlDisciplineBlockList(),
new ControlDisciplineList(),
new ControlLecturerAcademicDegreeList(),
new ControlLecturerAcademicRankList(),
new ControlLecturerList(),
new ControlEducationDirectionList(),
new ControlTimeNormList(),
new ControlAcademicPlanList(),
new ControlStudentGroupList(),
new ControlStudentList(),
new ControlOrderList(),
new ControlBasicDepartmentList(),
new ControlOrderSyncHistoryList(),
new ControlStudentMarkSyncHistoryList(),
};
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()
{
return null;
}
}
}