完善公共事業費用與會計報表權限設定
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 53s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

- 新增 utility_fees 與 accounting 相關權限至 PermissionSeeder
- 更新 RoleController 加入權限群組中文標題映射
- 為會計報表匯出功能加上權限保護
- 前端加入 Can 組件保護按鈕顯示
- 更新權限管理 Skill 文件,補充 UI 顯示設定步驟
This commit is contained in:
2026-01-21 10:55:11 +08:00
parent 9a50bbf887
commit b3299618ce
5 changed files with 52 additions and 9 deletions

View File

@@ -110,10 +110,31 @@ export default function ProductIndex() {
- `canAny(permissions: string[])`: 檢查當前使用者是否擁有陣列中**任一**權限。
- `hasRole(role: string)`: 檢查當前使用者是否擁有指定角色。
## 5. 配置權限群組名稱 (Backend UI Config)
為了讓新權限在「角色與權限」管理介面中顯示正確的中文分組標題,需修改 Controller 設定。
### 步驟:
1. 開啟 `app/Http/Controllers/Admin/RoleController.php`
2. 找到 `getGroupedPermissions` 方法。
3. 在 `$groupDefinitions` 陣列中,新增 `{resource}` 對應的中文名稱。
### 範例:
```php
$groupDefinitions = [
'products' => '商品資料管理',
// ...
'utility_fees' => '公共事業費管理', // 新增此行
];
```
## 檢核清單
- [ ] `PermissionSeeder.php` 已新增權限字串。
- [ ] `PermissionSeeder.php` 已將新權限分配給對應角色。
- [ ] 已執行 `php artisan tenants:seed --class=PermissionSeeder` 更新資料庫。
- [ ] `RoleController.php` 已新增權限群組的中文名稱映射。
- [ ] 後端路由 (`routes/web.php`) 已加上 middleware 保護。
- [ ] 前端頁面/按鈕已使用 `usePermission` 進行顯示控制。