fix: [upload_stix] Fixed the `distribution` & `sharing_group_id` values checking

- we have to convert them to int to check with the
  list of distributions and sharing groups that
  have int keys
pull/9044/head
Christian Studer 2023-04-21 16:26:09 +02:00
parent a1b36cfb9c
commit 50c7b930f6
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 4 additions and 3 deletions

View File

@ -2388,8 +2388,9 @@ class EventsController extends AppController
$publish = $this->params['named']['publish'];
}
if (isset($this->params['named']['distribution'])) {
if (in_array($this->params['named']['distribution'], $distributionLevels)) {
$initialDistribution = $this->params['named']['distribution'];
$distribution = intval($this->params['named']['distribution']);
if (in_array($distribution, $distributionLevels)) {
$initialDistribution = $distribution;
} else {
throw new MethodNotAllowedException(__('Wrong distribution level'));
}
@ -2399,7 +2400,7 @@ class EventsController extends AppController
if (!isset($this->params['named']['sharing_group_id'])) {
throw new MethodNotAllowedException(__('The sharing group id is needed when the distribution is set to 4 ("Sharing group").'));
}
$sharingGroupId = $this->params['named']['sharing_group_id'];
$sharingGroupId = intval($this->params['named']['sharing_group_id']);
if (!in_array($sharingGroupId, $sgs)) {
throw new MethodNotAllowedException(__('Please select a valid sharing group id.'));
}