chg: [user:registration] Added audit log

pull/5809/head
mokaddem 2020-04-22 10:04:07 +02:00
parent 46a940acb8
commit 6bff239740
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
3 changed files with 21 additions and 0 deletions

View File

@ -2395,6 +2395,17 @@ class UsersController extends AppController
if ($this->_isRest()) {
return $this->RestResponse->saveSuccessResponse('User', 'discardRegistrations', false, $this->response->type(), $message);
} else {
$this->Log = ClassRegistry::init('Log');
$this->Log->create();
$this->Log->save(array(
'org' => $this->Auth->user('Organisation')['name'],
'model' => 'User',
'model_id' => $id,
'email' => $this->Auth->user('email'),
'action' => 'discardRegistrations',
'title' => $message,
'change' => ''
));
$this->Flash->success($message);
$this->redirect(array('controller' => 'users', 'action' => 'registrations'));
}

View File

@ -58,6 +58,7 @@ class Log extends AppModel
'reset_auth_key',
'security',
'serverSettingsEdit',
'succeeded_registration',
'tag',
'undelete',
'update',

View File

@ -1550,6 +1550,15 @@ class User extends AppModel
'recursive' => -1,
'conditions' => array('id' => $this->id)
));
$this->Log->save(array(
'org' => 'SYSTEM',
'model' => 'User',
'model_id' => $added_by['id'],
'email' => $added_by['email'],
'action' => 'succeeded_registration',
'title' => sprintf('User registration success for %s (id=%s)', $user['User']['email'], $user['User']['id']),
'change' => null,
));
$this->initiatePasswordReset($user, true, true, false);
$this->Inbox = ClassRegistry::init('Inbox');
$this->Inbox->delete($registration['id']);