[CLAUDE] PurchaseEvaluation: co gap GAN=NV chuc nang / GO=chi Truong phong (DeptManager) bat doi xung
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 4m48s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 4m48s
Tra Sol + anh Kiet (Zalo chot 14:25): tranh NV khac lo tay go co cua nguoi da gan. Handler SetPurchaseEvaluationUrgent gate BAT DOI XUNG theo IsUrgent: GAN (true) = role chuc nang (Procurement->do / CostControl->xanh / Admin->ca 2); GO (false) = role chuc nang + DeptManager (Truong phong) hoac Admin. FE PeDetailTabs nut toggle gate theo trang thai hien tai (da gap->can quyen GO; chua gap->can quyen GAN) → an nut GO voi NV thuong. Test PeUrgentToggleAuthzTests rewrite asymmetric (354 PASS 0 fail). FE 2 app SHA256-identical. Build slnx 0-err. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -38,11 +38,21 @@ public class SetPurchaseEvaluationUrgentCommandHandler(
|
||||
|
||||
var roles = currentUser.Roles;
|
||||
var isAdmin = roles.Contains(AppRoles.Admin);
|
||||
var isPro = roles.Contains(AppRoles.Procurement);
|
||||
var isCcm = roles.Contains(AppRoles.CostControl);
|
||||
var isDeptManager = roles.Contains(AppRoles.DeptManager);
|
||||
var hasPro = roles.Contains(AppRoles.Procurement);
|
||||
var hasCcm = roles.Contains(AppRoles.CostControl);
|
||||
|
||||
// [S77 Tra Sol/anh Kiệt — chốt 14:25] BẤT ĐỐI XỨNG theo IsUrgent:
|
||||
// • GẮN (true): "ai làm người đó gắn" → NV chức năng PRO/CCM tự đánh dấu (chỉ cần role chức năng).
|
||||
// • GỠ (false): "gỡ thì chỉ cho TP gỡ" → CHỈ Trưởng phòng (DeptManager) của phòng đó hoặc Admin
|
||||
// (tránh NV khác lỡ tay gỡ cờ của người đã gắn).
|
||||
var isPro = request.IsUrgent ? hasPro : (hasPro && isDeptManager);
|
||||
var isCcm = request.IsUrgent ? hasCcm : (hasCcm && isDeptManager);
|
||||
|
||||
if (!isAdmin && !isPro && !isCcm)
|
||||
throw new ForbiddenException("Chỉ PRO (Procurement) / CCM (CostControl) / Admin được đánh dấu phiếu gấp.");
|
||||
throw new ForbiddenException(request.IsUrgent
|
||||
? "Chỉ PRO (Cung ứng) / CCM (Kiểm soát chi phí) / Admin được đánh dấu phiếu gấp."
|
||||
: "Chỉ Trưởng phòng Cung ứng / Kiểm soát chi phí hoặc Admin được GỠ cờ gấp.");
|
||||
|
||||
// Snapshot để phát hiện chuyển false→true (MỚI bật gấp) → notify CEO 1 lần.
|
||||
var wasUrgent = entity.IsUrgentByPro || entity.IsUrgentByCcm;
|
||||
|
||||
Reference in New Issue
Block a user