Audit log for enabling/disabling a user

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-04-25 17:18:56 +02:00
parent ac0c21f4a7
commit 5ee445c54b
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with 18 additions and 0 deletions

View File

@ -60,6 +60,23 @@ class UserManagement extends Action {
);
}
/**
* Log enabling of users
*
* @param array $params
*/
public function change(array $params) {
if ($params['feature'] === 'enabled') {
$this->log(
$params['value'] === 'true' ? 'User enabled: "%s"' : 'User disabled: "%s"',
['user' => $params['user']->getUID()],
[
'user',
]
);
}
}
/**
* Logs changing of the user scope
*

View File

@ -90,6 +90,7 @@ class AuditLogger {
Util::connectHook('OC_User', 'post_createUser', $userActions, 'create');
Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete');
Util::connectHook('OC_User', 'changeUser', $userActions, 'change');
$this->userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']);
}