This commit is contained in:
2022-03-07 12:22:53 +00:00
parent 362aa31e15
commit 7271b54fba
39 changed files with 356 additions and 90 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "1.2.4.1";
private static String version { get; } = "1.2.4.2";
// Retrieve version.
public static String GetFullVersion () { return version; }
public static String GetAppVersion ()
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Fri 4-Mar-2022 15:28:05
// Code generated by Sarand Database Utilities Mon 7-Mar-2022 10:06:56
//---------------------------------------------------------------------------
namespace Saxonite.Base.App
{
@@ -306,6 +306,9 @@ namespace Saxonite.Base.App
UserRole_Id,
UserRole_UserAccountId,
UserRole_UserRoleCode,
UserRole_LastLoginAt,
UserRole_LastInvalidLoginAt,
UserRole_InvalidLoginCount,
UserRole_Notes,
UserRole_Flags,
UserRole_Status,
@@ -365,7 +368,7 @@ namespace Saxonite.Base.App
//-------------------------------------------------------------------
// Data members.
private static readonly int tableCount = 18;
private static readonly int columnCount = 318;
private static readonly int columnCount = 321;
private static ulong maxTextLen = 0;
//-------------------------------------------------------------------
@@ -819,6 +822,9 @@ namespace Saxonite.Base.App
new ColumnDfn(15,"Id",5,-5,true,19),
new ColumnDfn(15,"UserAccountId",4,4,false,10),
new ColumnDfn(15,"UserRoleCode",0,12,false,16),
new ColumnDfn(15,"LastLoginAt",9,93,false,16),
new ColumnDfn(15,"LastInvalidLoginAt",9,93,false,16),
new ColumnDfn(15,"InvalidLoginCount",3,5,false,5),
new ColumnDfn(15,"Notes",0,-9,false,2000),
new ColumnDfn(15,"Flags",3,5,false,5),
new ColumnDfn(15,"Status",0,12,false,3),
@@ -75,9 +75,15 @@ namespace Saxonite.Net.Standard.Base.App
UserAccountId = userAccount.Id;
RefreshUserData(userAccount);
if (sessionContext.Application == Sax.Application.Admin)
KeepLoggedIn = userAccount.KeepLoggedIn_Admin;
{
// Admin 'Keep logged in' recorded against System Admin user role.
SaxUserRole userRole = userRoles.Find(item => item.UserRole == Sax.UserRole.SystemAdmin);
if (userRole != null)
KeepLoggedIn = userRole.KeepLoggedIn;
}
else if (sessionContext.Application == Sax.Application.Online)
KeepLoggedIn = userAccount.KeepLoggedIn_Online;
// Online 'Keep logged in' recorded against System Admin user role.
KeepLoggedIn = userAccount.KeepLoggedIn;
else Debugger.Break();
if (userRoles != null)
@@ -48,6 +48,11 @@ namespace Saxonite.Net.Standard.Base.Bus
// Associated data.
UserRoleCount,
SystemAdminUser,
LastAdminLoginOn,
LastAdminLoginAt,
LastInvalidAdminLoginOn,
LastInvalidAdminLoginAt,
InvalidAdminLoginCount,
// Common.
Notes,
Flags,
@@ -453,17 +458,11 @@ namespace Saxonite.Net.Standard.Base.Bus
//-------------------------------------------------------------------
// Flags - positions 1-16 available.
public Byte Flag_KeepLoggedIn_Admin { get; } = 0x1;
public Byte Flag_KeepLoggedIn_Online { get; } = 0x2;
public bool KeepLoggedIn_Admin
public Byte Flag_KeepLoggedIn { get; } = 0x1;
public bool KeepLoggedIn
{
get { return GetFlag(Flag_KeepLoggedIn_Admin); }
set { SetFlag(Flag_KeepLoggedIn_Admin, value); }
}
public bool KeepLoggedIn_Online
{
get { return GetFlag(Flag_KeepLoggedIn_Online); }
set { SetFlag(Flag_KeepLoggedIn_Online, value); }
get { return GetFlag(Flag_KeepLoggedIn); }
set { SetFlag(Flag_KeepLoggedIn, value); }
}
//-------------------------------------------------------------------
@@ -21,6 +21,12 @@ namespace Saxonite.Net.Standard.Base.Bus
UserAccountId,
UserRole,
UserRole_Desc,
// Login - Admin for System user.
LastLoginOn,
LastLoginAt,
LastInvalidLoginOn,
LastInvalidLoginAt,
InvalidLoginCount,
// User.
User_EmailAddress,
User_DisplayName,
@@ -44,6 +50,10 @@ namespace Saxonite.Net.Standard.Base.Bus
{
public SysId UserAccountId { get; set; }
public Sax.UserRole UserRole { get; set; }
// Login.
public DateTime LastLoginAt { get; set; } = DateTime.MinValue;
public DateTime LastInvalidLoginAt { get; set; } = DateTime.MinValue;
public short InvalidLoginCount { get; set; }
}
//-------------------------------------------------------------------
@@ -68,11 +78,31 @@ namespace Saxonite.Net.Standard.Base.Bus
get { return data.UserRole; }
set { CheckChanged((int)data.UserRole, (int)value); data.UserRole = value; }
}
// Login.
public DateTime LastLoginAt
{
get { return data.LastLoginAt; }
set { CheckChanged(data.LastLoginAt, value); data.LastLoginAt = value; }
}
public DateTime LastInvalidLoginAt
{
get { return data.LastInvalidLoginAt; }
set { CheckChanged(data.LastInvalidLoginAt, value); data.LastInvalidLoginAt = value; }
}
public short InvalidLoginCount
{
get { return data.InvalidLoginCount; }
set { CheckChanged(data.InvalidLoginCount, value); data.InvalidLoginCount = value; }
}
// Population.
internal void PopulateFrom(Data data)
{
UserAccountId = data.UserAccountId;
UserRole = data.UserRole;
// Login.
LastLoginAt = data.LastLoginAt;
LastInvalidLoginAt = data.LastInvalidLoginAt;
InvalidLoginCount = data.InvalidLoginCount;
base.PopulateFrom(data);
}
public Data Clone()
@@ -90,6 +120,10 @@ namespace Saxonite.Net.Standard.Base.Bus
// Identifies the field that has invalid data.
public ValidValue UserAccountId { get; set; } = ValidValue.Valid;
public ValidValue UserRole { get; set; } = ValidValue.Valid;
// Login.
public ValidValue LastLogin { get; set; } = ValidValue.Valid;
public ValidValue LastInvalidLogin { get; set; } = ValidValue.Valid;
public ValidValue InvalidLoginCount { get; set; } = ValidValue.Valid;
}
//-------------------------------------------------------------------
@@ -164,8 +198,32 @@ namespace Saxonite.Net.Standard.Base.Bus
protected set { data.UserRole = value; }
}
// Login - Admin application for System Admin role.
public DateTime LastLoginAt
{
get { return data.LastLoginAt; }
set { data.LastLoginAt = value; }
}
public DateTime LastInvalidLoginAt
{
get { return data.LastInvalidLoginAt; }
set { data.LastInvalidLoginAt = value; }
}
public short InvalidLoginCount
{
get { return data.InvalidLoginCount; }
set { data.InvalidLoginCount = value; }
}
//-------------------------------------------------------------------
// Flags - positions 1-16 available.
// Keep logged in - Admin application for System Admin role.
public Byte Flag_KeepLoggedIn { get; } = 0x1;
public bool KeepLoggedIn
{
get { return GetFlag(Flag_KeepLoggedIn); }
set { SetFlag(Flag_KeepLoggedIn, value); }
}
//-------------------------------------------------------------------
// A s s o c i a t e d D a t a
@@ -2,6 +2,7 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Base.App;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
@@ -91,6 +92,32 @@ namespace Saxonite.Net.Standard.Base.Mgr
return SetErrorState("User Role must be specified");
}
// Login - Admin application for System users.
if (errField.LastLogin != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.LastLoginAt))
{
if (data.UserRole != Sax.UserRole.SystemAdmin)
{
errField.LastLogin = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Last Login can only be set for System Admin role");
}
}
if (errField.LastInvalidLogin != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.LastInvalidLoginAt))
{
if (data.UserRole != Sax.UserRole.SystemAdmin)
{
errField.LastLogin = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Last Invalid Login can only be set for System Admin role");
}
}
if (errField.InvalidLoginCount != SacsHierarchyItem.ValidValue.Ignore && data.InvalidLoginCount > 0)
{
if (data.UserRole != Sax.UserRole.SystemAdmin)
{
errField.LastLogin = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Invalid Login Count can only be set for System Admin role");
}
}
//---------------------------------------------------------------
// Common properties.
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserRole_Notes)))