admin_audit and dav listen to announce and revoke signals
also place them in doc Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
8fe914f07e
commit
2ebf26e444
6 changed files with 55 additions and 0 deletions
|
@ -50,6 +50,19 @@ class UserManagement extends Action {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log assignments of users (typically user backends)
|
||||
*
|
||||
* @param string $uid
|
||||
*/
|
||||
public function announce(string $uid) {
|
||||
$this->log(
|
||||
'UserID assgined: "%s"',
|
||||
[ 'uid' => $uid ],
|
||||
[ 'uid' ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log deletion of users
|
||||
*
|
||||
|
@ -65,6 +78,19 @@ class UserManagement extends Action {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log unassignments of users (typically user backends, no data removed)
|
||||
*
|
||||
* @param string $uid
|
||||
*/
|
||||
public function revoke(string $uid) {
|
||||
$this->log(
|
||||
'UserID unassigned: "%s"',
|
||||
[ 'uid' => $uid ],
|
||||
[ 'uid' ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log enabling of users
|
||||
*
|
||||
|
|
|
@ -93,6 +93,8 @@ class Application extends App {
|
|||
/** @var IUserSession|Session $userSession */
|
||||
$userSession = $this->getContainer()->getServer()->getUserSession();
|
||||
$userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']);
|
||||
$userSession->listen('\OC\User', 'announceUser', [$userActions, 'announce']);
|
||||
$userSession->listen('\OC\User', 'postRevokeUser', [$userActions, 'revoke']);
|
||||
}
|
||||
|
||||
protected function groupHooks(ILogger $logger) {
|
||||
|
|
|
@ -77,14 +77,22 @@ class HookManager {
|
|||
'post_createUser',
|
||||
$this,
|
||||
'postCreateUser');
|
||||
\OC::$server->getUserManager()->listen('\OC\User', 'announceUser', function ($uid) {
|
||||
$this->postCreateUser(['uid' => $uid]);
|
||||
});
|
||||
Util::connectHook('OC_User',
|
||||
'pre_deleteUser',
|
||||
$this,
|
||||
'preDeleteUser');
|
||||
\OC::$server->getUserManager()->listen('\OC\User', 'preRevokeUser', [$this, 'preRevokeUser']);
|
||||
Util::connectHook('OC_User',
|
||||
'post_deleteUser',
|
||||
$this,
|
||||
'postDeleteUser');
|
||||
\OC::$server->getUserManager()->listen('\OC\User', 'postRevokeUser', function ($uid) {
|
||||
$this->postDeleteUser(['uid' => $uid]);
|
||||
});
|
||||
\OC::$server->getUserManager()->listen('\OC\User', 'postRevokeUser', [$this, 'postRevokeUser']);
|
||||
Util::connectHook('OC_User',
|
||||
'changeUser',
|
||||
$this,
|
||||
|
@ -103,6 +111,10 @@ class HookManager {
|
|||
$this->addressBooksToDelete = $this->cardDav->getUsersOwnAddressBooks('principals/users/' . $uid);
|
||||
}
|
||||
|
||||
public function preRevokeUser($uid) {
|
||||
$this->usersToDelete[$uid] = $this->userManager->get($uid);
|
||||
}
|
||||
|
||||
public function postDeleteUser($params) {
|
||||
$uid = $params['uid'];
|
||||
if (isset($this->usersToDelete[$uid])){
|
||||
|
@ -119,6 +131,12 @@ class HookManager {
|
|||
}
|
||||
}
|
||||
|
||||
public function postRevokeUser($uid) {
|
||||
if (isset($this->usersToDelete[$uid])){
|
||||
$this->syncService->deleteUser($this->usersToDelete[$uid]);
|
||||
}
|
||||
}
|
||||
|
||||
public function changeUser($params) {
|
||||
$user = $params['user'];
|
||||
$this->syncService->updateUser($user);
|
||||
|
|
|
@ -50,6 +50,9 @@ use OCP\UserInterface;
|
|||
* - preCreateUser(string $uid, string $password)
|
||||
* - postCreateUser(\OC\User\User $user, string $password)
|
||||
* - change(\OC\User\User $user)
|
||||
* - announceUser(string $uid)
|
||||
* - preRevokeUser(string $uid)
|
||||
* - postRevokeUser(string $uid)
|
||||
*
|
||||
* @package OC\User
|
||||
*/
|
||||
|
|
|
@ -72,6 +72,9 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
* - postDelete(\OC\User\User $user)
|
||||
* - preCreateUser(string $uid, string $password)
|
||||
* - postCreateUser(\OC\User\User $user)
|
||||
* - announceUser(string $uid)
|
||||
* - preRevokeUser(string $uid)
|
||||
* - postRevokeUser(string $uid)
|
||||
* - preLogin(string $user, string $password)
|
||||
* - postLogin(\OC\User\User $user, string $password)
|
||||
* - preRememberedLogin(string $uid)
|
||||
|
|
|
@ -40,6 +40,9 @@ namespace OCP;
|
|||
* - postDelete(\OC\User\User $user)
|
||||
* - preCreateUser(string $uid, string $password)
|
||||
* - postCreateUser(\OC\User\User $user, string $password)
|
||||
* - announceUser(string $uid)
|
||||
* - preRevokeUser(string $uid)
|
||||
* - postRevokeUser(string $uid)
|
||||
*
|
||||
* @package OC\User
|
||||
* @since 8.0.0
|
||||
|
|
Loading…
Reference in a new issue