fix: Added missing db field to users

- fixes a nasty issue with saving users failing when ZMQ is enabled on instances installed after 2.4.69
- fixes a typo that caused invalid user changes being pushed to the ZMQ channel
pull/2902/head
iglocska 2018-02-02 19:44:41 +01:00
parent 9f3d36f3e5
commit 8b78df3cf9
3 changed files with 10 additions and 3 deletions

View File

@ -1074,6 +1074,8 @@ CREATE TABLE IF NOT EXISTS `users` (
`current_login` int(11) DEFAULT 0,
`last_login` int(11) DEFAULT 0,
`force_logout` tinyint(1) NOT NULL DEFAULT 0,
`date_created` bigint(20),
`date_modified` bigint(20),
PRIMARY KEY (`id`),
INDEX `email` (`email`),
INDEX `org_id` (`org_id`),

View File

@ -60,7 +60,7 @@ class AppModel extends Model {
);
public $db_changes = array(
1 => false
1 => false, 2 => false
);
function afterSave($created, $options = array()) {
@ -871,6 +871,11 @@ class AppModel extends Model {
$sqlArray[] = "ALTER TABLE `tags` ADD `user_id` int(11) NOT NULL DEFAULT 0;";
$sqlArray[] = 'ALTER TABLE `tags` ADD INDEX `user_id` (`user_id`);';
break;
case 2:
// rerun missing db entries
$sqlArray[] = "ALTER TABLE users ADD COLUMN date_created bigint(20);";
$sqlArray[] = "ALTER TABLE users ADD COLUMN date_modified bigint(20);";
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;';

View File

@ -272,8 +272,8 @@ class User extends AppModel {
if (isset($user['User']['id'])) {
$user = $this->find('first', array(
'recursive' => -1,
'condiitons' => array('User.id' => $user['User']['id']),
'fields' => array('id', 'email', 'last_login', 'date_modified', 'org_id', 'termsaccepted', 'autoalert', 'newsread', 'disabled'),
'conditons' => array('User.id' => $user['User']['id']),
'fields' => array('id', 'email', 'last_login', 'org_id', 'termsaccepted', 'autoalert', 'newsread', 'disabled'),
'contain' => array(
'Organisation' => array(
'fields' => array('Organisation.id', 'Organisation.name', 'Organisation.description', 'Organisation.uuid', 'Organisation.nationality', 'Organisation.sector', 'Organisation.type', 'Organisation.local')