mirror of https://github.com/MISP/MISP
fix: [decaying] Set default value and pre-checks
parent
60338499c7
commit
f59b338c47
|
@ -3138,6 +3138,9 @@ class Attribute extends AppModel
|
||||||
if (!isset($options['decayingModel'])) {
|
if (!isset($options['decayingModel'])) {
|
||||||
$options['decayingModel'] = false;
|
$options['decayingModel'] = false;
|
||||||
}
|
}
|
||||||
|
if (!isset($options['modelOverrides'])) {
|
||||||
|
$options['modelOverrides'] = array();
|
||||||
|
}
|
||||||
if (!isset($options['excludeDecayed'])) {
|
if (!isset($options['excludeDecayed'])) {
|
||||||
$options['excludeDecayed'] = 0;
|
$options['excludeDecayed'] = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -166,7 +166,11 @@ class DecayingModel extends AppModel
|
||||||
|
|
||||||
public function isDefaultModel($decaying_model)
|
public function isDefaultModel($decaying_model)
|
||||||
{
|
{
|
||||||
return !is_null($decaying_model['DecayingModel']['uuid']);
|
if (isset($decaying_model['DecayingModel']['uuid'])) {
|
||||||
|
return !is_null($decaying_model['DecayingModel']['uuid']);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isEditableByCurrentUser($user, $decaying_model)
|
public function isEditableByCurrentUser($user, $decaying_model)
|
||||||
|
@ -482,9 +486,9 @@ class DecayingModel extends AppModel
|
||||||
$models = $this->fetchModels($user, $associated_model_ids, false, array('enabled' => true));
|
$models = $this->fetchModels($user, $associated_model_ids, false, array('enabled' => true));
|
||||||
}
|
}
|
||||||
} elseif (is_array($model_id)) {
|
} elseif (is_array($model_id)) {
|
||||||
$models = $this->fetchModels($user, $model_id, false, array('enabled' => true));
|
$models = $this->fetchModels($user, $model_id, false, array());
|
||||||
} else {
|
} else {
|
||||||
$models[] = $this->fetchModel($user, $model_id, false, array('enabled' => true));
|
$models[] = $this->fetchModel($user, $model_id, false, array());
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($models as $i => $model) {
|
foreach ($models as $i => $model) {
|
||||||
|
|
Loading…
Reference in New Issue