mirror of https://github.com/MISP/MISP
parent
8a9783400a
commit
eff2f77126
|
@ -19,7 +19,7 @@ class Attribute extends AppModel {
|
|||
'userModel' => 'User',
|
||||
'userKey' => 'user_id',
|
||||
'change' => 'full'
|
||||
),// 'Trim' => array('fields' => array('value'))
|
||||
), 'Trim' // => array('fields' => array('value'))
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,19 @@ class TrimBehavior extends ModelBehavior {
|
|||
$this->settings[$Model->alias], (array)$settings);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $options
|
||||
*/
|
||||
public function beforeValidate(Model $Model, $options = array()) {
|
||||
//parent::beforeValidate();
|
||||
|
||||
// process some..
|
||||
$this->trimStringFields($Model);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim String Fields
|
||||
*
|
||||
|
|
|
@ -14,7 +14,7 @@ class Event extends AppModel {
|
|||
'userModel' => 'User',
|
||||
'userKey' => 'user_id',
|
||||
'change' => 'full'
|
||||
));
|
||||
), 'Trim');
|
||||
|
||||
/**
|
||||
* Display field
|
||||
|
|
|
@ -51,7 +51,7 @@ class Group extends AppModel {
|
|||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
public $actsAs = array('Acl' => array('type' => 'requester'), 'MagicTools.OrphansProtectable');
|
||||
public $actsAs = array('Acl' => array('type' => 'requester'), 'MagicTools.OrphansProtectable', 'Trim');
|
||||
|
||||
/**
|
||||
* TODO ACL: 2: hook Group into CakePHP ACL system (so link to aros)
|
||||
|
|
|
@ -104,19 +104,6 @@ class Server extends AppModel {
|
|||
),
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $options
|
||||
*/
|
||||
public function beforeValidate($options = array()) {
|
||||
parent::beforeValidate();
|
||||
|
||||
// process some..
|
||||
$this->trimStringFields();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isOwnedByOrg($serverid, $org) {
|
||||
return $this->field('id', array('id' => $serverid, 'org' => $org)) === $serverid;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ class User extends AppModel {
|
|||
'userModel' => 'User',
|
||||
'userKey' => 'user_id',
|
||||
'change' => 'full'
|
||||
)
|
||||
), 'Trim'
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,8 @@ class Whitelist extends AppModel {
|
|||
*/
|
||||
public $displayField = 'name';
|
||||
|
||||
public $actsAs = array('Trim');
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue