86 lines
2.8 KiB
C#
86 lines
2.8 KiB
C#
using Sarand.Core.Bus;
|
|
using Sarand.Core.UpdateLog;
|
|
using Sarand.PatientMgr.Core.App;
|
|
using Sarand.PatientMgr.Win.Dbas.Consoles;
|
|
using Sarand.PatientMgr.Win.Forms.App;
|
|
using Sarand.Win.Dbas.Base;
|
|
using Sarand.Win.Forms.Security;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Sarand.PatientMgr.App.Consoles
|
|
{
|
|
//=======================================================================
|
|
public class SpmSecurityConsole_App : SpmSecurityConsole_Dbas
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
public SpmSecurityConsole_App (SpmSessionContext sessionContext, SacsDatabase database) :
|
|
base(sessionContext, database)
|
|
{
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
public override SaUpdateLogConsole UpdateLogConsole { get { return SpmGlobals.Application.GetUpdateLogConsole(SessionContext); } }
|
|
|
|
//-------------------------------------------------------------------
|
|
// Security events.
|
|
protected override bool OnLogin (SysId userId)
|
|
{
|
|
return SpmGlobals_Win.SecurityProfile.RefreshProfile(this, userId, GetSecurityRights());
|
|
}
|
|
protected override void OnLogout ()
|
|
{
|
|
SpmGlobals_Win.SecurityProfile.RefreshProfile(this, null, GetSecurityRights());
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Method to show User Login form.
|
|
protected override ShowUserLoginFormFunction ShowUserLoginFormFn
|
|
{
|
|
get
|
|
{
|
|
return SaForm_UserLogin.ShowUserLoginForm;
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Method to display Security management form.
|
|
protected override ShowManageSecurityDialogFunction ShowManageSecurityDialogFn
|
|
{
|
|
get
|
|
{
|
|
return SaForm_ManageSecurity.ShowManageSecurityDialog;
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
public override bool OnUserModified (SysId userId)
|
|
{
|
|
if (!SysId.IsValid(userId)) return false;
|
|
SpmSecurityProfile securityProfile = SpmGlobals_Win.SecurityProfile;
|
|
if (securityProfile.UserId.Equals(userId))
|
|
securityProfile.RefreshProfile(this, userId, GetSecurityRights());
|
|
return true;
|
|
}
|
|
public override bool OnSecurityGroupModified (SysId secGroupId)
|
|
{
|
|
if (!SysId.IsValid(secGroupId)) return false;
|
|
SpmSecurityProfile securityProfile = SpmGlobals_Win.SecurityProfile;
|
|
if (securityProfile.IsUserMemberOfSecurityGroup(secGroupId))
|
|
securityProfile.RefreshProfile(this, securityProfile.UserId, GetSecurityRights());
|
|
return true;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|