new: push the action for user updates/creations/logins along with the user object to the ZMQ channel

pull/2643/merge
iglocska 2017-11-16 08:58:53 +01:00
parent 5303b86987
commit 943f18d6cc
2 changed files with 8 additions and 3 deletions

View File

@ -778,8 +778,11 @@ class UsersController extends AppController {
$this->__extralog("login"); // TODO Audit, __extralog, check: customLog i.s.o. __extralog, no auth user?: $this->User->customLog('login', $this->Auth->user('id'), array('title' => '','user_id' => $this->Auth->user('id'),'email' => $this->Auth->user('email'),'org' => 'IN2'));
$this->User->Behaviors->disable('SysLogLogable.SysLogLogable');
$this->User->id = $this->Auth->user('id');
$this->User->saveField('last_login', $this->Auth->user('current_login'));
$this->User->saveField('current_login', time());
$user = $this->Auth->user();
$user['action'] = 'login';
$user['last_login'] = $this->Auth->user('current_login');
$user['current_login'] = time();
$this->User->save($user);
if (empty($this->Auth->authenticate['Form']['passwordHasher']) && !empty($passwordToSave)) $this->User->saveField('password', $passwordToSave);
$this->User->Behaviors->enable('SysLogLogable.SysLogLogable');
// TODO removed the auto redirect for now, due to security concerns - will look more into this

View File

@ -267,6 +267,8 @@ class User extends AppModel {
if (!isset($user['User'])) {
$user['User'] = $user;
}
$action = isset($user['User']['id']) ? 'edit' : 'add';
if (isset($user['action'])) $action = $user['action'];
if (isset($user['User']['id']))
$user = $this->find('first', array(
'recursive' => -1,
@ -282,7 +284,7 @@ class User extends AppModel {
unset($user['User']['password']);
unset($user['User']['confirm_password']);
}
$pubSubTool->modified($user, 'user');
$pubSubTool->modified($user, 'user', $action);
}
return true;
}