mirror of https://github.com/MISP/MISP
UUID support for syncing
parent
2c7f01f61e
commit
495cc1a6c2
|
@ -83,7 +83,8 @@ class EventsController extends AppController {
|
|||
// force check userid and orgname to be from yourself
|
||||
$this->request->data['Event']['user_id'] = $this->Auth->user('id');
|
||||
$this->request->data['Event']['org'] = $this->Auth->user('org');
|
||||
$this->Event->create();
|
||||
$this->request->data['Event']['uuid'] = String::uuid();
|
||||
$this->Event->create();
|
||||
if ($this->Event->save($this->request->data)) {
|
||||
$this->Session->setFlash(__('The event has been saved'));
|
||||
$this->redirect(array('action' => 'view', $this->Event->getId()));
|
||||
|
@ -126,7 +127,7 @@ class EventsController extends AppController {
|
|||
$this->request->data['Event']['alerted'] = 0;
|
||||
|
||||
// say what fields are to be updated
|
||||
$fieldList=array('user_id', 'org', 'date', 'risk', 'info', 'alerted');
|
||||
$fieldList=array('user_id', 'org', 'date', 'risk', 'info', 'alerted', 'private');
|
||||
if ($this->Event->save($this->request->data, true, $fieldList)) {
|
||||
$this->Session->setFlash(__('The event has been saved'));
|
||||
$this->redirect(array('action' => 'view', $id));
|
||||
|
|
|
@ -61,7 +61,7 @@ class SignaturesController extends AppController {
|
|||
|
||||
$this->Signature->create();
|
||||
$this->request->data['Signature']['value'] = $signature; // set the value as the content of the single line
|
||||
|
||||
$this->request->data['Signature']['uuid'] = String::uuid();
|
||||
if ($this->Signature->save($this->request->data)) {
|
||||
$successes .= " ".($key+1);
|
||||
} else {
|
||||
|
@ -89,6 +89,8 @@ class SignaturesController extends AppController {
|
|||
//
|
||||
// create the signature
|
||||
$this->Signature->create();
|
||||
$this->request->data['Signature']['uuid'] = String::uuid();
|
||||
|
||||
if ($this->Signature->save($this->request->data)) {
|
||||
// inform the user and redirect
|
||||
$this->Session->setFlash(__('The signature has been saved'));
|
||||
|
@ -128,7 +130,7 @@ class SignaturesController extends AppController {
|
|||
|
||||
if ($this->Signature->save($this->request->data)) {
|
||||
$this->Session->setFlash(__('The signature has been saved'));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
$this->redirect($this->referer());
|
||||
} else {
|
||||
$this->Session->setFlash(__('The signature could not be saved. Please, try again.'));
|
||||
}
|
||||
|
@ -136,6 +138,11 @@ class SignaturesController extends AppController {
|
|||
$this->request->data = $this->Signature->read(null, $id);
|
||||
}
|
||||
|
||||
|
||||
// combobox for types
|
||||
$types = $this->Signature->validate['type']['rule'][1];
|
||||
$types = $this->_arrayToValuesIndexArray($types);
|
||||
$this->set('types',compact('types'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -271,7 +271,7 @@ class UsersController extends AppController {
|
|||
|
||||
|
||||
// What org posted what type of signature
|
||||
// LATER beautify types_histogram
|
||||
// LATER beautify types_histogram http://dev.sencha.com/deploy/ext-4.0.0/examples/charts/StackedBar.html
|
||||
$this->loadModel('Signature');
|
||||
$fields = array('Event.org', 'Signature.type', 'count(Signature.type) as `num_types`');
|
||||
$params = array('recursive' => 0,
|
||||
|
|
|
@ -87,6 +87,16 @@ class Event extends AppModel {
|
|||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||
),
|
||||
),
|
||||
'private' => array(
|
||||
'boolean' => array(
|
||||
'rule' => array('boolean'),
|
||||
//'message' => 'Your custom message here',
|
||||
//'allowEmpty' => false,
|
||||
'required' => false,
|
||||
//'last' => false, // Stop validation after this rule
|
||||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||
|
|
|
@ -92,6 +92,26 @@ class Signature extends AppModel {
|
|||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||
),
|
||||
),
|
||||
'revision' => array(
|
||||
'numeric' => array(
|
||||
'rule' => array('numeric'),
|
||||
//'message' => 'Your custom message here',
|
||||
//'allowEmpty' => false,
|
||||
//'required' => false,
|
||||
//'last' => false, // Stop validation after this rule
|
||||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||
),
|
||||
),
|
||||
'private' => array(
|
||||
'boolean' => array(
|
||||
'rule' => array('boolean'),
|
||||
//'message' => 'Your custom message here',
|
||||
//'allowEmpty' => false,
|
||||
'required' => false,
|
||||
//'last' => false, // Stop validation after this rule
|
||||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||
|
@ -111,6 +131,16 @@ class Signature extends AppModel {
|
|||
)
|
||||
);
|
||||
|
||||
|
||||
function beforeSave() {
|
||||
// increment the revision number
|
||||
if (empty($this->data['Signature']['revision'])) $this->data['Signature']['revision'] = 0;
|
||||
$this->data['Signature']['revision'] = 1 + $this->data['Signature']['revision'] ;
|
||||
|
||||
// always return true after a beforeSave()
|
||||
return true;
|
||||
}
|
||||
|
||||
function validateSignatureValue ($fields) {
|
||||
$value = $fields['value'];
|
||||
$event_id = $this->data['Signature']['event_id'];
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
echo $this->Form->input('date');
|
||||
echo $this->Form->input('risk');
|
||||
echo $this->Form->input('info');
|
||||
|
||||
|
||||
?>
|
||||
</fieldset>
|
||||
<?php echo $this->Form->end(__('Submit', true));?>
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
</tr>
|
||||
<?php
|
||||
foreach ($events as $event):
|
||||
// FIXME reactivate the onclick without breaking the delete form submit
|
||||
?>
|
||||
<!-- <tr onclick="document.location ='<?php echo $this->Html->url(array('action' => 'view', $event['Event']['id']), true) ;?>';" > -->
|
||||
<tr>
|
||||
<td onclick="document.location ='<?php echo $this->Html->url(array('action' => 'view', $event['Event']['id']), true) ;?>';">
|
||||
<?php echo $this->Html->link($event['Event']['id'], array('controller' => 'events', 'action' => 'view', $event['Event']['id'])); ?>
|
||||
|
@ -64,6 +62,5 @@
|
|||
<div class="actions">
|
||||
<ul>
|
||||
<?php echo $this->element('actions_menu'); ?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -40,6 +40,11 @@
|
|||
<?php echo $event['Event']['risk']; ?>
|
||||
|
||||
</dd>
|
||||
<!-- dt>UUID</dt>
|
||||
<dd>
|
||||
<?php echo $event['Event']['uuid']; ?>
|
||||
|
||||
</dd -->
|
||||
<dt>Info</dt>
|
||||
<dd>
|
||||
<?php echo nl2br(Sanitize::html($event['Event']['info'])); ?>
|
||||
|
|
|
@ -16,14 +16,13 @@
|
|||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
$cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework');
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<?php echo $this->Html->charset(); ?>
|
||||
<title>
|
||||
<?php echo $cakeDescription ?>:
|
||||
CyDefSIG:
|
||||
<?php echo $title_for_layout; ?>
|
||||
</title>
|
||||
<?php
|
||||
|
|
|
@ -4,21 +4,18 @@
|
|||
<legend><?php echo __('Edit Signature'); ?></legend>
|
||||
<?php
|
||||
echo $this->Form->input('id');
|
||||
echo $this->Form->input('event_id');
|
||||
echo $this->Form->input('type');
|
||||
echo $this->Form->input('value');
|
||||
echo $this->Form->input('to_ids');
|
||||
echo $this->Form->input('uuid');
|
||||
?>
|
||||
</fieldset>
|
||||
<?php echo $this->Form->end(__('Submit'));?>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
|
||||
<li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('Signature.id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('Signature.id'))); ?></li>
|
||||
<li><?php echo $this->Html->link(__('List Signatures'), array('action' => 'index'));?></li>
|
||||
<li><?php echo $this->Html->link(__('List Events'), array('controller' => 'events', 'action' => 'index')); ?> </li>
|
||||
<li><?php echo $this->Html->link(__('New Event'), array('controller' => 'events', 'action' => 'add')); ?> </li>
|
||||
<li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('Signature.id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('Signature.id'))); ?></li>
|
||||
<li> </li>
|
||||
<?php echo $this->element('actions_menu'); ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -46,3 +46,6 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="users index">
|
||||
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<p><b>Backend rewrite + security</b><br/>
|
||||
Complete rewrite of the backend code to migrate to CakePHP 2.x (from CakePHP 1.3). <br/>
|
||||
During this rewrite the code was cleaned up, CSRF protection should now be present on all the important actions.<br/>
|
||||
Password strength validation, anti-bruteforce has been implemented.<br/>
|
||||
Password strength validation has been implemented.<br/>
|
||||
Some intermittent bugs might have slipped in during the (manual) conversion. Please contact me <a href="mailto:user1088@qet.be">user1088@qet.be</a> to report any issues.
|
||||
</p>
|
||||
<p><b>Terms and News</b><br/>
|
||||
|
|
Loading…
Reference in New Issue