diff --git a/CLAUDE.md b/CLAUDE.md index 49627ba..699b220 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -449,6 +449,28 @@ Gotcha in user approval: `UserDA.Approve` always sets `Status = Approved` (5), w can never actually be approved. The user list labels that action "Re-activate" for this reason; the fix belongs in the server. +### Authentication pages: maker-checker and audit log + +Role, Role Permission, User, User Role and User Access Type (Authentication menu) are **maker-checker**: a +change is saved with an `EnumAuthStatus` (`HRM.BO/HRBasic/Enums.cs`) pending state — `NewNotYetApprove` (2), +`DeletedNotYetApprove` (3), `EditedNotYetApprove` (4), `Inactive_Not_Yet_Approve` (9) — and only becomes +`Approved` (5) / `Rejected` (10) when a second user approves it (`UserAccessTypeService.RequestChange` / +`Approve` / `Reject`, `RoleService` for roles and permissions). Follow that state set for any new +Authentication page rather than inventing a status column. + +The **System Audit Log** page (`SystemAuditHistoryService`, `HRM.DA/DA/Users/SystemAuditHistoryDA.cs`) writes +nothing itself: it reads `Z_ROLE`, `Z_ROLEPERMISSION`, `Z_USERS`, `Z_USERROLE`, `Z_USERACCESSTYPE`, which +**database triggers** (`trRole`, `trRolePermission`, `trUsers`, `truserrole`, `trUserAccessType`) fill. Only +`trRole` and `trUserAccessType` are scripted (root `SystemAuditHistory_DB_Changes.sql`); the other three +already exist in the databases and are not in the repo. Triggers must be set-based (approve/reject touch many +rows in one statement). The acting user reaches a trigger through `SESSION_CONTEXT(N'AuditUserID')`, set by +`UserAccessTypeDA` (`sp_set_session_context`) inside the same transaction — do the same when auditing a new +table. That script's stated prerequisite, `UserAccessTypeMakerChecker_DB_Changes.sql`, is not in this repo. + +`AuthController.CipherMechanism` (`api/Authentication/CipherMechanism`, Angular `authentication/cipher-engine`) +encrypts a value with the same `Ease.NetCore` cipher used for passwords — another reason that NuGet stays at +1.0.5. + `PayrollTypeID` is the scoping key threaded through most payroll/attendance queries — when adding a query that returns employee data, check whether existing siblings filter by it. Reading `EmployeeID` throws for a self-service (`EnumUserType.Employee`) login that has none, so guard accordingly. diff --git a/HRM.DA/Service/Basic/BankService.cs b/HRM.DA/Service/Basic/BankService.cs index ff66f96..2b25f72 100644 --- a/HRM.DA/Service/Basic/BankService.cs +++ b/HRM.DA/Service/Basic/BankService.cs @@ -343,13 +343,11 @@ namespace HRM.DA if (oBank.Code ==string.Empty) oBank.Code = GlobalFunctionService.GetMaxCode(tc, "banks", "Code"); - oBank.CreatedBy = 1; oBank.CreatedDate = DateTime.Now; BankDA.Insert(tc, oBank); } else { - oBank.ModifiedBy = 1; oBank.ModifiedDate = DateTime.Now; BankDA.Update(tc, oBank); } diff --git a/HRM.DA/Service/Common/RegularDataUploadService.cs b/HRM.DA/Service/Common/RegularDataUploadService.cs index 697e17c..ba85660 100644 --- a/HRM.DA/Service/Common/RegularDataUploadService.cs +++ b/HRM.DA/Service/Common/RegularDataUploadService.cs @@ -4759,6 +4759,32 @@ namespace HRM.DA //} + // Stamps the uploading user on every object of an upload list before its SaveForUpload: + // CreatedBy/CreatedDate on new rows, ModifiedBy/ModifiedDate on every row. + private void SetAuditInfo(List items, int userID) where T : AuditTrailBase + { + if (items == null) + return; + + DateTime now = DateTime.Now; + foreach (T item in items) + { + if (item == null) + continue; + + if (item.IsNew || item.CreatedBy <= 0) + { + item.CreatedBy = userID; + item.CreatedDate = now; + } + else + { + item.ModifiedBy = userID; + item.ModifiedDate = now; + } + } + } + public void Save(List categorys, List grades, List departments, List locations, List religions, List designations, List banks, diff --git a/HRM.UI/ClientApp/src/version.json b/HRM.UI/ClientApp/src/version.json index bc92988..1c0d3ae 100644 --- a/HRM.UI/ClientApp/src/version.json +++ b/HRM.UI/ClientApp/src/version.json @@ -1,4 +1,4 @@ { - "version": "20261115-03", - "buildTime": "2026-11-15T08:30:42.0805569Z" + "version": "20261117-01", + "buildTime": "2026-11-17T10:52:35.6354741Z" } diff --git a/HRM.UI/appsettings.json b/HRM.UI/appsettings.json index 607abe1..620a8f4 100644 --- a/HRM.UI/appsettings.json +++ b/HRM.UI/appsettings.json @@ -52,8 +52,8 @@ //"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDB;User Id=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", //"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=autocrop;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", // Development - "Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDBBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", - "SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBBRAC;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;" // Development + "Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDBUATBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", + "SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBUATBRAC;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;" // Development }, "Calendar": {