Chương 10 — Phụ lục
Phần này tổng hợp thông tin tham chiếu: RBAC matrix, file storage, vận hành cho IT.
RBAC Matrix
Mỗi user có một role được tự động sinh từ {department}_{position} (ví dụ supply_manager, kho_staff). IT luôn là it_super_admin.
| Phòng ban | Manager | Staff | Intern | Quyền chính |
|---|---|---|---|---|
| BOD | ✓ | ✓ | — | approve_demand_po, approve_payment, view all |
| Demand | ✓ | ✓ | ✓ | create_demand_po, edit_demand_po |
| Supply | ✓ | ✓ | ✓ | create_factory_po, confirm_factory_po, create_payment |
| Accounting | ✓ | ✓ | — | mark_paid_payment, upload invoice |
| Kho | ✓ | ✓ | — | receive_warehouse |
| IT | Tất cả → it_super_admin | Mọi quyền (super admin), manage_users, import_master_data | ||
User Resource (/admin/users) chỉ visible cho IT. Khi tạo/sửa user, IT chọn department + position; hệ thống tự sync Spatie role tương ứng qua User::spatieRoleName().
File Storage (MinIO)
Hệ thống lưu file lên MinIO (S3-compatible) ở bucket rechic-dpms:
| Path | Loại | Giới hạn |
|---|---|---|
sku-images/ | JPEG/PNG/WebP | ≤ 5 MB/file |
invoices/ | ≤ 10 MB/file | |
master-data-imports/{Y}/{m}/ | XLSX | Theo Excel |
MinIO Console: http://localhost:9001 (chỉ IT truy cập). Credentials trong .env.
Master Data Import — known limitations
- Barcode reissue: Khi brand reissue barcode cho cùng SKU+size đã có variant, INSERT bị fail (unique constraint). Mỗi row lỗi ghi vào
errors_jsonkèm thông báo, các row khác vẫn import bình thường. Fix: Brand team xoá variant cũ hoặc không reissue barcode. - errors_json cap 500 entries — không có endpoint download full set khi vượt cap.
- Không có "Continue" hoặc "Download original" trong Resource history. Workaround: re-upload qua MinIO Console.
Scheduled Commands — chi tiết
Tham chiếu Chương 9 — Scheduled Jobs. Các lệnh được register trong routes/console.php; queue worker container rechic_dpms2_queue chạy worker cho job channel.
Vận hành (cho IT)
- Setup môi trường:
docker compose up -d docker exec -it rechic_dpms2_app composer run setup npm run dev # frontend Vite (chạy host) - Reset password:
docker exec -it rechic_dpms2_app php artisan tinker >>> User::where("email","x@y.com")->first()->update(["password" => bcrypt("newpw")]); - Restart containers:
docker compose restart - Re-sync role của user: sửa
department/positiontrong UI; Resource auto sync Spatie role. - Default admin:
admin@rechic.vn/password(role:it_super_admin).
Tài liệu kỹ thuật
Spec và plan chi tiết của từng tính năng được lưu tại docs/superpowers/specs/ và docs/superpowers/plans/. Toàn bộ code conventions trong CLAUDE.md.