106 lines
5.3 KiB
C#
106 lines
5.3 KiB
C#
using Sarand.Core.Base;
|
|
using Sarand.PatientMgr.Core.App;
|
|
using Sarand.Win.Dbas.Base;
|
|
using Sarand.Win.Dbas.Security;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Sarand.PatientMgr.Win.Dbas.Consoles
|
|
{
|
|
//=======================================================================
|
|
public abstract class SpmSecurityConsole_Dbas : SaSecurityConsole_Dbas
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private static List<TypeCodeDesc> securityRights = new List<TypeCodeDesc>();
|
|
|
|
//-------------------------------------------------------------------
|
|
// Static initialisation.
|
|
static SpmSecurityConsole_Dbas ()
|
|
{
|
|
securityRights.Add((int)Spm.SecurityRight.ManageSecurity, "MngSec", "Manage Security");
|
|
securityRights.Add((int)Spm.SecurityRight.ManageConfig, "MngCfg", "Manage Config");
|
|
securityRights.Add((int)Spm.SecurityRight.ManageDb, "MngDb", "Manage Database");
|
|
securityRights.Add((int)Spm.SecurityRight.DepartmentView, "DeptView", "View department");
|
|
securityRights.Add((int)Spm.SecurityRight.DepartmentReserve, "DeptReserve", "Reserve department");
|
|
securityRights.Add((int)Spm.SecurityRight.DepartmentUpdate, "DeptUpd", "Update department");
|
|
securityRights.Add((int)Spm.SecurityRight.DepartmentConfig, "DeptCfg", "Manage department");
|
|
securityRights.Add((int)Spm.SecurityRight.ConsultantView, "ConsView", "View Consultant");
|
|
securityRights.Add((int)Spm.SecurityRight.ConsultantUpdate, "ConsUpd", "Update Consultant");
|
|
securityRights.Add((int)Spm.SecurityRight.SpecialityView, "SpecView", "View Speciality");
|
|
securityRights.Add((int)Spm.SecurityRight.SpecialityUpdate, "SpecUpd", "Update Speciality");
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
protected SpmSecurityConsole_Dbas (SpmSessionContext sessionContext, SacsDatabase database) : base(database)
|
|
{
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
public List<TypeCodeDesc> GetSecurityRights () { return new List<TypeCodeDesc>(securityRights); }
|
|
|
|
//-------------------------------------------------------------------
|
|
// Register Security Rights.
|
|
public override void RegisterSecurityRights ()
|
|
{
|
|
//---------------------------------------------------------------
|
|
// Register data item types.
|
|
RegisterDataItemType((short)Spm.DataItemType.Department, "Department");
|
|
RegisterDataItemType((short)Spm.DataItemType.RoleConsultant, "Consultant");
|
|
RegisterDataItemType((short)Spm.DataItemType.CodeSpeciality, "Speciality");
|
|
|
|
//---------------------------------------------------------------
|
|
// Manage security.
|
|
CodeDesc securityRight = GetSecurityRight(Spm.SecurityRight.ManageSecurity);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc);
|
|
// Manage configuration.
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.ManageConfig);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc);
|
|
// Manage database.
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.ManageDb);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc);
|
|
|
|
//---------------------------------------------------------------
|
|
// View department:
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.DepartmentView);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.Department);
|
|
// Make reservation in department:
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.DepartmentReserve);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.Department);
|
|
// Update department:
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.DepartmentUpdate);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.Department);
|
|
// Manage department:
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.DepartmentConfig);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.Department);
|
|
//---------------------------------------------------------------
|
|
// Security rights associated with specific consultant:
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.ConsultantView);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.RoleConsultant);
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.ConsultantUpdate);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.RoleConsultant);
|
|
//---------------------------------------------------------------
|
|
// Security rights associated with specific speciality:
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.SpecialityView);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.CodeSpeciality);
|
|
securityRight = GetSecurityRight(Spm.SecurityRight.SpecialityUpdate);
|
|
RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.CodeSpeciality);
|
|
|
|
//---------------------------------------------------------------
|
|
}
|
|
|
|
CodeDesc GetSecurityRight (Spm.SecurityRight securityRight)
|
|
{
|
|
return securityRights.GetCodeDescForType((int)securityRight);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|