Merge branch '2.4' into develop

pull/8244/head
iglocska 2022-03-21 17:08:32 +01:00
commit 66b129c5a1
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
4 changed files with 24 additions and 2 deletions

2
PyMISP

@ -1 +1 @@
Subproject commit c5646d7463932f5c58b9569a7d771cdb8b2c048a
Subproject commit 156f6d9083a83f8af8968eaf54d6f4d64e5a4395

View File

@ -1326,6 +1326,27 @@ class AppController extends Controller
return false;
}
/**
* Returns true if user can publish the given event.
*
* @param array $event
* @return bool
*/
protected function __canPublishEvent(array $event)
{
if (!isset($event['Event'])) {
throw new InvalidArgumentException('Passed object does not contain an Event.');
}
if ($this->userRole['perm_site_admin']) {
return true;
}
if ($this->userRole['perm_publish'] && $event['Event']['orgc_id'] == $this->Auth->user()['org_id']) {
return true;
}
return false;
}
/**
* Returns true if user can add or remove tags for given event.
*

View File

@ -1655,6 +1655,7 @@ class EventsController extends AppController
$this->set('warnings', $this->Event->generateWarnings($event));
$this->set('menuData', array('menuList' => 'event', 'menuItem' => 'viewEvent'));
$this->set('mayModify', $this->__canModifyEvent($event));
$this->set('mayPublish', $this->__canPublishEvent($event));
try {
$instanceKey = $this->Event->CryptographicKey->ingestInstanceKey();
} catch (Exception $e) {

@ -1 +1 @@
Subproject commit 9515ae332e45d9ac306eaaaa802b605c1090cf5c
Subproject commit 18a683ac984437fea4c620ae25057f32b6da7f26