Skip to content

Commit

Permalink
Merge pull request #989 from dbarzin/dev
Browse files Browse the repository at this point in the history
Add authenticity parameter
  • Loading branch information
dbarzin authored Dec 1, 2024
2 parents 4c064bb + a472dd8 commit 1152ada
Show file tree
Hide file tree
Showing 42 changed files with 1,151 additions and 441 deletions.
1 change: 1 addition & 0 deletions app/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Database extends Model
'security_need_i',
'security_need_a',
'security_need_t',
'security_need_auth',
'external',
'created_at',
'updated_at',
Expand Down
66 changes: 66 additions & 0 deletions app/Http/Controllers/Admin/CartographyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,17 @@ public function cartography(Request $request)
trans('global.tracability') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$macroProcess->security_need_t] ?? '') .
(
config('mercator-config.parameters.security_need_auth') ?
(
'<br>' .
trans('global.authenticity') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$macroProcess->security_need_auth] ?? '')
)
:
""
) .
'</p>'
);
//---
Expand Down Expand Up @@ -442,6 +453,17 @@ public function cartography(Request $request)
trans('global.tracability') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$process->security_need_t] ?? '') .
(
config('mercator-config.parameters.security_need_auth') ?
(
'<br>' .
trans('global.authenticity') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$process->security_need_auth] ?? '')
)
:
""
) .
'</p>'
);
// Owner
Expand Down Expand Up @@ -594,6 +616,17 @@ public function cartography(Request $request)
trans('global.tracability') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$information->security_need_t] ?? '') .
(
config('mercator-config.parameters.security_need_auth') ?
(
'<br>' .
trans('global.authenticity') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$information->security_need_auth] ?? '')
)
:
""
) .
'</p>'
);

Expand Down Expand Up @@ -762,6 +795,17 @@ public function cartography(Request $request)
trans('global.tracability') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$application->security_need_t] ?? '') .
(
config('mercator-config.parameters.security_need_auth') ?
(
'<br>' .
trans('global.authenticity') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$application->security_need_auth] ?? '')
)
:
""
) .
'</p>'
);

Expand Down Expand Up @@ -1011,6 +1055,17 @@ public function cartography(Request $request)
trans('global.tracability') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$database->security_need_t] ?? '') .
(
config('mercator-config.parameters.security_need_auth') ?
(
'<br>' .
trans('global.authenticity') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$database->security_need_auth] ?? '')
)
:
""
) .
'</p>'
);

Expand Down Expand Up @@ -1394,6 +1449,17 @@ public function cartography(Request $request)
trans('global.tracability') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$network->security_need_t] ?? '') .
(
config('mercator-config.parameters.security_need_auth') ?
(
'<br>' .
trans('global.authenticity') .
' : ' .
([1 => trans('global.low'),2 => trans('global.medium'),3 => trans('global.strong'),4 => trans('global.very_strong')][$network->security_need_auth] ?? '')
)
:
""
) .
'</p>'
);
//----
Expand Down
44 changes: 44 additions & 0 deletions app/Http/Controllers/Admin/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,48 @@ public function saveCVEConfig(Request $request)
)
->withErrors($msg);
}

/*
* Return the parameters
*/
public function getParameters()
{
abort_if(Gate::denies('configure'), Response::HTTP_FORBIDDEN, '403 Forbidden');

// Get configuration
$security_need_auth = config('mercator-config.parameters.security_need_auth');

// Return
return view(
'admin.config.parameters',
compact('security_need_auth')
);
}

/*
* Save the parameters
*/
public function saveParameters(Request $request)
{
abort_if(Gate::denies('configure'), Response::HTTP_FORBIDDEN, '403 Forbidden');

// read request
$security_need_auth = request('security_need_auth');

// Save parameters
config(['mercator-config.parameters.security_need_auth' => $security_need_auth]);

// Save configuration
$text = '<?php return ' . var_export(config('mercator-config'), true) . ';';
file_put_contents(config_path('mercator-config.php'), $text);

// Return
return view(
'admin.config.parameters',
compact('security_need_auth')
)
->withErrors('Configuration saved !');
}


}
Loading

0 comments on commit 1152ada

Please sign in to comment.