feat: 確保 super-admin 角色擁有系統所有權限且開啟 Gate bypass
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 47s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-13 17:21:36 +08:00
parent 2e7aeef367
commit a0a61ba683
2 changed files with 52 additions and 3 deletions

View File

@@ -15,14 +15,16 @@ class AppServiceProvider extends ServiceProvider
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
// 如果是在正式環境,強制轉為 https
if (config('app.env') === 'production') {
URL::forceScheme('https');
}
// 隱含授權:讓 "super-admin" 角色擁有所有權限
\Illuminate\Support\Facades\Gate::before(function ($user, $ability) {
return $user->hasRole('super-admin') ? true : null;
});
}
}