mirror of https://github.com/MISP/MISP
Changes to the tagging
- tags can now be set correctly for all events - some UI changes to the tags - moved the deletion of all event_tags when a tag gets deleted to beforefilterpull/224/head
parent
914687142e
commit
4279ca5130
|
@ -2056,9 +2056,9 @@ class EventsController extends AppController {
|
|||
$tag_id = $this->request->data['Event']['tag'];
|
||||
$id = $this->request->data['Event']['id'];
|
||||
$this->Event->recurisve = -1;
|
||||
$event = $this->Event->read(array('id', 'org', 'orgc'), $id);
|
||||
$event = $this->Event->read(array('id', 'org', 'orgc', 'distribution'), $id);
|
||||
// org should allow to tag too, so that an event that gets pushed can be tagged locally by the owning org
|
||||
if ($this->Auth->user('org') !== $event['Event']['org'] && $this->Auth->user('org') !== $event['Event']['orgc'] && !$this->_isSiteAdmin()) {
|
||||
if (($this->Auth->user('org') !== $event['Event']['org'] && $this->Auth->user('org') !== $event['Event']['orgc'] && $event['Event']['distribution'] == 0) || (!$this->userRole['perm_tagger']) && !$this->_isSiteAdmin()) {
|
||||
throw new MethodNotAllowedException('You don\'t have permission to do that.');
|
||||
}
|
||||
$this->Event->EventTag->Tag->id = $tag_id;
|
||||
|
@ -2087,9 +2087,9 @@ class EventsController extends AppController {
|
|||
throw new MethodNotAllowedException('You don\'t have permission to do that.');
|
||||
}
|
||||
$this->Event->recurisve = -1;
|
||||
$event = $this->Event->read(array('id', 'org', 'orgc'), $id);
|
||||
$event = $this->Event->read(array('id', 'org', 'orgc', 'distribution'), $id);
|
||||
// org should allow to tag too, so that an event that gets pushed can be tagged locally by the owning org
|
||||
if ($this->Auth->user('org') !== $event['Event']['org'] && $this->Auth->user('org') !== $event['Event']['orgc'] && !$this->_isSiteAdmin()) {
|
||||
if (($this->Auth->user('org') !== $event['Event']['org'] && $this->Auth->user('org') !== $event['Event']['orgc'] && $event['Event']['distribution'] == 0) || (!$this->userRole['perm_tagger']) && !$this->_isSiteAdmin()) {
|
||||
throw new MethodNotAllowedException('You don\'t have permission to do that.');
|
||||
}
|
||||
$eventTag = $this->Event->EventTag->find('first', array(
|
||||
|
|
|
@ -74,7 +74,6 @@ class TagsController extends AppController {
|
|||
throw new NotFoundException('Invalid tag');
|
||||
}
|
||||
if ($this->Tag->delete()) {
|
||||
$this->Tag->EventTag->deleteAll(array('EventTag.tag_id' => $id));
|
||||
$this->Session->setFlash(__('Attribute deleted'));
|
||||
} else {
|
||||
$this->Session->setFlash(__('Attribute was not deleted'));
|
||||
|
|
|
@ -58,6 +58,12 @@ class Tag extends AppModel {
|
|||
'className' => 'EventTag',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
public function beforeDelete($cascade = true) {
|
||||
$this->EventTag->deleteAll(array('EventTag.tag_id' => $this->id));
|
||||
}
|
||||
|
||||
public function validateColour($fields) {
|
||||
if (!preg_match('/^#[0-9a-f]{6}$/i', $fields['colour'])) return false;
|
||||
return true;
|
||||
|
|
|
@ -108,7 +108,8 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
|
|||
<button id="addTagButton" class="btn btn-inverse" style="line-height:10px; padding: 4px 4px;">+</button>
|
||||
|
||||
</td>
|
||||
<?php else: echo ' ';
|
||||
<?php else:
|
||||
if (empty($tags)) echo ' ';
|
||||
endif; ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue