Views updated to include CSV in the menues

- CSV and also IOC downloads on events are now hidden if the event is
not published
pull/217/head
iglocska 2013-06-26 17:20:56 +02:00
parent 5e9d19196d
commit 39e99554c9
10 changed files with 33 additions and 5 deletions

View File

@ -237,6 +237,7 @@ class AttributesController extends AppController {
$this->set('attrDescriptions', $this->Attribute->fieldDescriptions);
$this->set('typeDefinitions', $this->Attribute->typeDefinitions);
$this->set('categoryDefinitions', $this->Attribute->categoryDefinitions);
$this->set('published', $events['Event']['published']);
}
public function download($id = null) {
@ -439,6 +440,7 @@ class AttributesController extends AppController {
$this->set('distributionLevels', $this->Event->distributionLevels);
$events = $this->Event->findById($eventId);
$this->set('currentDist', $events['Event']['distribution']);
$this->set('published', $events['Event']['published']);
}
/**

View File

@ -422,6 +422,10 @@ class EventsController extends AppController {
// set the id
$this->set('id', $id);
$this->Event->recursive = -1;
$this->Event->read(null, $id);
// set whether it is published or not
$this->set('published', $this->Event->data['Event']['published']);
// tooltip for risk
$this->set('riskDescriptions', $this->Event->riskDescriptions);

View File

@ -63,11 +63,11 @@ class LogsController extends AppController {
// check if the user has access to this event...
$mayModify = false;
$mineOrAdmin = false;
$this->loadModel('Event');
$this->Event->recursive = -1;
$this->Event->read(null, $id);
// send unauthorised people away. Only site admins and users of the same org may see events that are "your org only". Everyone else can proceed for all other levels of distribution
if ($this->Auth->user('org') != 'ADMIN') {
$this->loadModel('Event');
$this->Event->recursive = -1;
$this->Event->read(null, $id);
if ($this->Event->data['Event']['distribution'] == 0) {
if ($this->Event->data['Event']['org'] != $this->Auth->user('org')) {
$this->Session->setFlash(__('You don\'t have access to view this event.'));
@ -79,6 +79,7 @@ class LogsController extends AppController {
} else {
$mineOrAdmin = true;
}
$this->set('published', $this->Event->data['Event']['published']);
if ($mineOrAdmin && $this->checkAction('perm_modify')) $mayModify = true;
// get a list of the attributes that belong to the event
$this->loadModel('Attribute');

View File

@ -58,7 +58,10 @@ echo $this->Form->end();
<li class="divider"></li>
<li><a href="/events/contact/<?php echo $this->request->data['Attribute']['event_id']; ?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $this->request->data['Attribute']['event_id']; ?>">Download as XML</a></li>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $this->request->data['Attribute']['event_id']; ?>">Download as IOC</a></li>
<?php if ($published): ?>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $this->request->data['Attribute']['event_id'];?>">Download as IOC</a></li>
<li><a href="/events/csv/download/<?php echo $this->request->data['Attribute']['event_id'];?>">Download as CSV</a></li>
<?php endif; ?>
<li class="divider"></li>
<li><a href="/events/index">List Events</a></li>
<?php if ($isAclAdd): ?>

View File

@ -56,7 +56,10 @@ echo $this->Form->end();
<li class="divider"></li>
<li><a href="/events/contact/<?php echo $this->request->data['Attribute']['event_id']; ?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $this->request->data['Attribute']['event_id']; ?>">Download as XML</a></li>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $this->request->data['Attribute']['event_id']; ?>">Download as IOC</a></li>
<?php if ($published): ?>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $this->request->data['Attribute']['event_id'];?>">Download as IOC</a></li>
<li><a href="/events/csv/download/<?php echo $this->request->data['Attribute']['event_id'];?>">Download as CSV</a></li>
<?php endif; ?>
<li class="divider"></li>
<li><a href="/events/index">List Events</a></li>
<?php if ($isAclAdd): ?>

View File

@ -32,7 +32,10 @@ echo $this->Form->end();
<li class="divider"></li>
<li><a href="/events/contact/<?php echo $id;?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $id;?>">Download as XML</a></li>
<?php if ($published): ?>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $id;?>">Download as IOC</a></li>
<li><a href="/events/csv/download/<?php echo $id;?>">Download as CSV</a></li>
<?php endif; ?>
<li class="divider"></li>
<li><a href="/events/index">List Events</a></li>
<?php if ($isAclAdd): ?>

View File

@ -51,7 +51,10 @@ $mayPublish = ($isAclPublish && $this->request->data['Event']['orgc'] == $me['or
<li class="divider"></li>
<li class="active"><a href="/events/contact/<?php echo $this->data['Event']['id'];?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $this->data['Event']['id'];?>">Download as XML</a></li>
<?php if ($this->data['Event']['published']): ?>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $this->data['Event']['id'];?>">Download as IOC</a></li>
<li><a href="/events/csv/download/<?php echo $this->data['Event']['id'];?>">Download as CSV</a></li>
<?php endif; ?>
<li class="divider"></li>
<li><a href="/events/index">List Events</a></li>
<?php if ($isAclAdd): ?>

View File

@ -46,7 +46,10 @@ echo $this->Form->end();
<li class="divider"></li>
<li><a href="/events/contact/<?php echo $this->request->data['Event']['id'];?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $this->request->data['Event']['id'];?>">Download as XML</a></li>
<?php if ($this->request->data['Event']['published']): ?>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $this->request->data['Event']['id'];?>">Download as IOC</a></li>
<li><a href="/events/csv/download/<?php echo $this->request->data['Event']['id'];?>">Download as CSV</a></li>
<?php endif; ?>
<li class="divider"></li>
<li><a href="/events/index">List Events</a></li>
<?php if ($isAclAdd): ?>

View File

@ -26,7 +26,10 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
<?php endif; ?>
<li><a href="/events/contact/<?php echo $event['Event']['id'];?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $event['Event']['id'];?>">Download as XML</a></li>
<?php if ($event['Event']['published']): ?>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $event['Event']['id'];?>">Download as IOC</a></li>
<li><a href="/events/csv/download/<?php echo $event['Event']['id'];?>">Download as CSV</a></li>
<?php endif; ?>
<li class="divider"></li>
<li><a href="/events/index">List Events</a></li>
<?php if ($isAclAdd): ?>

View File

@ -67,7 +67,10 @@
<li class="divider"></li>
<li><a href="/events/contact/<?php echo $eventId;?>">Contact reporter</a></li>
<li><a href="/events/xml/download/<?php echo $eventId;?>">Download as XML</a></li>
<?php if ($published): ?>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $eventId;?>">Download as IOC</a></li>
<li><a href="/events/csv/download/<?php echo $eventId;?>">Download as CSV</a></li>
<?php endif; ?>
<li class="divider"></li>
<li><a href="/events/index">List Events</a></li>
<?php if ($isAclAdd): ?>