1515 */
1616class RiskScoringConfigController extends Controller
1717{
18+
1819 public function __construct (private readonly RiskScoringService $ scoringService )
1920 {
2021 }
2122
2223 private function checkAdmin (): void
2324 {
24- if (Auth::user ()->role !== 1 ) {
25+ if (! Auth::user ()->isAdmin () ) {
2526 abort (403 );
2627 }
2728 }
@@ -44,24 +45,35 @@ public function create(): View
4445 $ config = new RiskScoringConfig ([
4546 'formula ' => 'probability_x_impact ' ,
4647 'probability_levels ' => [
47- ['value ' => 1 , 'label ' => 'Rare ' , 'description ' => '' ],
48- ['value ' => 2 , 'label ' => 'Peu probable ' , 'description ' => '' ],
49- ['value ' => 3 , 'label ' => 'Possible ' , 'description ' => '' ],
50- ['value ' => 4 , 'label ' => 'Probable ' , 'description ' => '' ],
51- ['value ' => 5 , 'label ' => 'Très probable ' , 'description ' => '' ],
48+ ['value ' => 1 , 'label ' => __ ('cruds.risk_scoring.defaults.probability_levels.rare ' ), 'description ' => '' ],
49+ ['value ' => 2 , 'label ' => __ ('cruds.risk_scoring.defaults.probability_levels.unlikely ' ), 'description ' => '' ],
50+ ['value ' => 3 , 'label ' => __ ('cruds.risk_scoring.defaults.probability_levels.possible ' ), 'description ' => '' ],
51+ ['value ' => 4 , 'label ' => __ ('cruds.risk_scoring.defaults.probability_levels.likely ' ), 'description ' => '' ],
52+ ['value ' => 5 , 'label ' => __ ('cruds.risk_scoring.defaults.probability_levels.very_likely ' ), 'description ' => '' ],
53+ ],
54+ 'exposure_levels ' => [
55+ ['value ' => 0 , 'label ' => __ ('cruds.risk_scoring.defaults.exposure_levels.offline ' ), 'description ' => '' ],
56+ ['value ' => 1 , 'label ' => __ ('cruds.risk_scoring.defaults.exposure_levels.internal ' ), 'description ' => '' ],
57+ ['value ' => 2 , 'label ' => __ ('cruds.risk_scoring.defaults.exposure_levels.internet ' ), 'description ' => '' ],
58+ ],
59+ 'vulnerability_levels ' => [
60+ ['value ' => 1 , 'label ' => __ ('cruds.risk_scoring.defaults.vulnerability_levels.none ' ), 'description ' => '' ],
61+ ['value ' => 2 , 'label ' => __ ('cruds.risk_scoring.defaults.vulnerability_levels.known ' ), 'description ' => '' ],
62+ ['value ' => 3 , 'label ' => __ ('cruds.risk_scoring.defaults.vulnerability_levels.exploitable_int ' ), 'description ' => '' ],
63+ ['value ' => 4 , 'label ' => __ ('cruds.risk_scoring.defaults.vulnerability_levels.exploitable_ext ' ), 'description ' => '' ],
5264 ],
5365 'impact_levels ' => [
54- ['value ' => 1 , 'label ' => ' Négligeable ' , 'description ' => '' ],
55- ['value ' => 2 , 'label ' => ' Faible ' , 'description ' => '' ],
56- ['value ' => 3 , 'label ' => ' Modéré ' , 'description ' => '' ],
57- ['value ' => 4 , 'label ' => ' Élevé ' , 'description ' => '' ],
58- ['value ' => 5 , 'label ' => ' Critique ' , 'description ' => '' ],
66+ ['value ' => 1 , 'label ' => __ ( ' cruds.risk_scoring.defaults.impact_levels.negligible ' ) , 'description ' => '' ],
67+ ['value ' => 2 , 'label ' => __ ( ' cruds.risk_scoring.defaults.impact_levels.low ' ), 'description ' => '' ],
68+ ['value ' => 3 , 'label ' => __ ( ' cruds.risk_scoring.defaults.impact_levels.moderate ' ), 'description ' => '' ],
69+ ['value ' => 4 , 'label ' => __ ( ' cruds.risk_scoring.defaults.impact_levels.high ' ) , 'description ' => '' ],
70+ ['value ' => 5 , 'label ' => __ ( ' cruds.risk_scoring.defaults.impact_levels.critical ' ), 'description ' => '' ],
5971 ],
6072 'risk_thresholds ' => [
61- ['level ' => 'low ' , 'label ' => ' Faible ' , 'max ' => 4 , 'color ' => '#27ae60 ' ],
62- ['level ' => 'medium ' , 'label ' => ' Moyen ' , 'max ' => 9 , 'color ' => '#f39c12 ' ],
63- ['level ' => 'high ' , 'label ' => ' Élevé ' , 'max ' => 16 , 'color ' => '#e74c3c ' ],
64- ['level ' => 'critical ' , 'label ' => ' Critique ' , 'max ' => null , 'color ' => '#c0392b ' ],
73+ ['level ' => 'low ' , 'label ' => __ ( ' cruds.risk_scoring.defaults.risk_thresholds.low ' ), 'max ' => 4 , 'color ' => '#27ae60 ' ],
74+ ['level ' => 'medium ' , 'label ' => __ ( ' cruds.risk_scoring.defaults.risk_thresholds.medium ' ), 'max ' => 9 , 'color ' => '#f39c12 ' ],
75+ ['level ' => 'high ' , 'label ' => __ ( ' cruds.risk_scoring.defaults.risk_thresholds.high ' ), 'max ' => 16 , 'color ' => '#e74c3c ' ],
76+ ['level ' => 'critical ' , 'label ' => __ ( ' cruds.risk_scoring.defaults.risk_thresholds.critical ' ) , 'max ' => null , 'color ' => '#c0392b ' ],
6577 ],
6678 ]);
6779
@@ -198,14 +210,14 @@ private function validateConfig(Request $request): array
198210// Helpers couleurs : migration legacy (noms de classes MetroUI) → hex
199211// -------------------------------------------------------------------------
200212
201- /*
202- private const COLOR_MAP = [
203- 'success' => '#27ae60',
204- 'warning' => '#f39c12',
205- 'danger' => '#e74c3c',
206- 'alert' => '#c0392b',
207- 'info' => '#2980b9',
208- 'secondary' => '#7f8c8d',
209- ];
210- */
213+ /*
214+ private const COLOR_MAP = [
215+ 'success' => '#27ae60',
216+ 'warning' => '#f39c12',
217+ 'danger' => '#e74c3c',
218+ 'alert' => '#c0392b',
219+ 'info' => '#2980b9',
220+ 'secondary' => '#7f8c8d',
221+ ];
222+ */
211223}
0 commit comments