Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Madis Cyber
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Soluris
Madis Cyber
Commits
9e763ee9
Commit
9e763ee9
authored
2 years ago
by
Jonathan Foucher
Browse files
Options
Downloads
Patches
Plain Diff
Update calculations for order of measures
parent
3001cbfd
No related branches found
No related tags found
No related merge requests found
Pipeline
#31654
failed
2 years ago
Stage: build
Stage: test
Stage: quality-assurance
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Repository/GraphDataRepository.php
+34
-30
34 additions, 30 deletions
app/Repository/GraphDataRepository.php
resources/js/components/Evaluations/Single/Components/Step4/MeasureLevelSelector.vue
+4
-1
4 additions, 1 deletion
...luations/Single/Components/Step4/MeasureLevelSelector.vue
with
38 additions
and
31 deletions
app/Repository/GraphDataRepository.php
+
34
−
30
View file @
9e763ee9
...
@@ -158,36 +158,6 @@ public function getFutureRisksDataForEvaluation(Evaluation $evaluation): array
...
@@ -158,36 +158,6 @@ public function getFutureRisksDataForEvaluation(Evaluation $evaluation): array
];
];
}
}
public
function
getBestMeasuresForEvaluation
(
Evaluation
$evaluation
):
array
{
$measureLevels
=
collect
(
$evaluation
->
measureLevels
);
// For each danger, add all points of all measures that apply to the danger scenarios
$dangers
=
Danger
::
all
();
$scenarios
=
Scenario
::
all
();
$measures
=
Measure
::
all
();
$bestMeasures
=
array_map
(
function
(
$i
)
{
return
0
;},
array_flip
(
$measures
->
pluck
(
'id'
)
->
toArray
()));
foreach
(
$scenarios
as
$scenario
)
{
// Get current exposition points for this scenarion
$exposition1
=
$this
->
getExpositionPointsForScenario
(
$scenario
,
$measureLevels
);
// Get exposition points for this scenario if all measures are lifted by one point
$exposition2
=
$this
->
getExpositionPointsForScenario
(
$scenario
,
$measureLevels
->
map
(
function
(
MeasureLevel
$l
)
{
$l
->
actual_level
=
min
(
$l
->
actual_level
+
2
,
3
);
return
$l
;
}));
// Add points for this measure if there is a difference in exposition
foreach
(
$scenario
->
measures
as
$measure
)
{
// Fundamental measures count double
$bestMeasures
[
$measure
->
id
]
+=
((
$exposition1
-
$exposition2
)
*
(
$measure
->
fundamental
?
2
:
1
));
}
}
return
collect
(
$bestMeasures
)
->
sortDesc
()
->
keys
()
->
toArray
();
}
public
function
getAttackDataForEvaluation
(
Evaluation
$evaluation
):
array
public
function
getAttackDataForEvaluation
(
Evaluation
$evaluation
):
array
{
{
...
@@ -227,6 +197,40 @@ public function getMaturityDataForEvaluation(Evaluation $evaluation): array
...
@@ -227,6 +197,40 @@ public function getMaturityDataForEvaluation(Evaluation $evaluation): array
];
];
}
}
public
function
getBestMeasuresForEvaluation
(
Evaluation
$evaluation
):
array
{
$measureLevels
=
collect
(
$evaluation
->
measureLevels
);
// For each danger, add all points of all measures that apply to the danger scenarios
$scenarios
=
Scenario
::
all
();
$measures
=
Measure
::
all
();
$bestMeasures
=
array_map
(
function
(
$i
)
{
return
0
;},
array_flip
(
$measures
->
pluck
(
'id'
)
->
toArray
()));
foreach
(
$evaluation
->
dangerLevels
as
$dangerLevel
)
{
/**
* @var DangerLevelEvaluation $dangerLevel
*/
foreach
(
$dangerLevel
->
danger
->
scenarios
as
$scenario
)
{
// Add points for this measure if there is a difference in exposition
foreach
(
$scenario
->
measures
as
$measure
)
{
$selectedLevel
=
$measureLevels
->
first
(
function
(
MeasureLevel
$level
)
use
(
$measure
)
{
return
$measure
->
id
===
$level
->
measure_id
;
});
// Fundamental measures count double
if
(
$selectedLevel
)
{
$l1
=
$measure
->
{
'level'
.
$selectedLevel
->
actual_level
.
'_value'
};
$l2
=
$measure
->
{
'level'
.
(
min
(
$selectedLevel
->
actual_level
+
1
,
3
))
.
'_value'
};
$bestMeasures
[
$measure
->
id
]
+=
(
$l2
-
$l1
)
*
$dangerLevel
->
level
->
value
;
}
}
}
}
return
collect
(
$bestMeasures
)
->
sortDesc
()
->
keys
()
->
toArray
();
}
private
function
getExpositionPointsForScenario
(
Scenario
$scenario
,
$measureLevels
):
float
private
function
getExpositionPointsForScenario
(
Scenario
$scenario
,
$measureLevels
):
float
{
{
// Get prorated count of measures
// Get prorated count of measures
...
...
This diff is collapsed.
Click to expand it.
resources/js/components/Evaluations/Single/Components/Step4/MeasureLevelSelector.vue
+
4
−
1
View file @
9e763ee9
...
@@ -2,7 +2,10 @@
...
@@ -2,7 +2,10 @@
<div
v-if=
"measureInformations"
>
<div
v-if=
"measureInformations"
>
<div
class=
"card"
:style=
"cssProps"
role=
"radio"
>
<div
class=
"card"
:style=
"cssProps"
role=
"radio"
>
<div
class=
"card-header h5 font-weight-bold text-center"
>
<div
class=
"card-header h5 font-weight-bold text-center"
>
{{
measure
.
short_name
}}
{{
measure
.
short_name
}}
<br>
<small
v-if=
"index
<
4"
>
(Préconisé)
</small>
</div>
</div>
<div
class=
"card-body"
>
<div
class=
"card-body"
>
<!-- Affiche un bouton radio et le détail du niveau -->
<!-- Affiche un bouton radio et le détail du niveau -->
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment