mirror of https://github.com/MISP/MISP
Destroy sessions on next page load for all users if there was a db update
parent
3f57ad3a5d
commit
32f3ce8542
|
@ -1 +1 @@
|
|||
{"major":2, "minor":4, "hotfix":32}
|
||||
{"major":2, "minor":4, "hotfix":33}
|
||||
|
|
|
@ -195,6 +195,15 @@ class AppController extends Controller {
|
|||
}
|
||||
|
||||
if ($this->Auth->user()) {
|
||||
// update script
|
||||
$this->{$this->modelClass}->runUpdates();
|
||||
$user = $this->Auth->user();
|
||||
if (!isset($user['force_logout']) || $user['force_logout']) {
|
||||
$this->loadModel('User');
|
||||
$this->User->id = $this->Auth->user('id');
|
||||
$this->User->saveField('force_logout', false);
|
||||
$this->Session->destroy();
|
||||
}
|
||||
if ($this->Auth->user('disabled')) {
|
||||
$this->Log = ClassRegistry::init('Log');
|
||||
$this->Log->create();
|
||||
|
@ -285,8 +294,6 @@ class AppController extends Controller {
|
|||
}
|
||||
$this->debugMode = 'debugOff';
|
||||
if (Configure::read('debug') > 1) $this->debugMode = 'debugOn';
|
||||
// update script
|
||||
$this->{$this->modelClass}->runUpdates();
|
||||
$this->set('loggedInUserName', $this->__convertEmailToName($this->Auth->user('email')));
|
||||
$this->set('debugMode', $this->debugMode);
|
||||
$notifications = $this->{$this->modelClass}->populateNotifications($this->Auth->user());
|
||||
|
|
|
@ -49,7 +49,7 @@ class AppModel extends Model {
|
|||
// major -> minor -> hotfix -> requires_logout
|
||||
public $db_changes = array(
|
||||
2 => array(
|
||||
4 => array(18 => false, 19 => false, 20 => false, 25 => false, 27 => false, 32 => false)
|
||||
4 => array(18 => false, 19 => false, 20 => false, 25 => false, 27 => false, 32 => false, 33 => false)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -309,6 +309,9 @@ class AppModel extends Model {
|
|||
$sqlArray[] = "ALTER TABLE `roles` ADD `perm_tag_editor` tinyint(1) NOT NULL DEFAULT '0';";
|
||||
$sqlArray[] = 'UPDATE `roles` SET `perm_tag_editor` = 1 WHERE `perm_tagger` = 1';
|
||||
break;
|
||||
case '2.4.33':
|
||||
$sqlArray[] = "ALTER TABLE `users` ADD `force_logout` tinyint(1) NOT NULL DEFAULT '0';";
|
||||
break;
|
||||
case 'fixNonEmptySharingGroupID':
|
||||
$sqlArray[] = 'UPDATE `events` SET `sharing_group_id` = 0 WHERE `distribution` != 4';
|
||||
$sqlArray[] = 'UPDATE `attributes` SET `sharing_group_id` = 0 WHERE `distribution` != 4';
|
||||
|
@ -389,7 +392,7 @@ class AppModel extends Model {
|
|||
}
|
||||
|
||||
public function cleanCacheFiles() {
|
||||
$directories = array(APP . '/tmp/cache/models', APP . '/tmp/cache/persistent');
|
||||
$directories = array(APP . 'tmp/cache/models', APP . 'tmp/cache/persistent');
|
||||
foreach ($directories as $directory) {
|
||||
$dir = new Folder($directory);
|
||||
$files = $dir->find('myapp.*');
|
||||
|
|
Loading…
Reference in New Issue