Commit c013bcbb authored by Vincent Petry's avatar Vincent Petry Committed by GitHub
Browse files

Use preDelete hook to delete encryption keys (#26938)

Because we sometimes need to mount the user's home before deleting
encryption keys, this must happen in a preDelete hook because the
postDelete is too late. In postDelete the user's home already doesn't
exist any more and cannot be mounted.
parent 4fcffcf3
......@@ -137,9 +137,9 @@ class UserHooks implements IHook {
'postCreateUser');
OCUtil::connectHook('OC_User',
'post_deleteUser',
'pre_deleteUser',
$this,
'postDeleteUser');
'preDeleteUser');
}
}
......@@ -194,7 +194,7 @@ class UserHooks implements IHook {
* @param array $params : uid, password
* @note This method should never be called for users using client side encryption
*/
public function postDeleteUser($params) {
public function preDeleteUser($params) {
if (App::isEnabled('encryption')) {
$this->keyManager->deletePublicKey($params['uid']);
......
......@@ -108,12 +108,12 @@ class UserHooksTest extends TestCase {
$this->assertTrue(true);
}
public function testPostDeleteUser() {
public function testPreDeleteUser() {
$this->keyManagerMock->expects($this->once())
->method('deletePublicKey')
->with('testUser');
$this->instance->postDeleteUser($this->params);
$this->instance->preDeleteUser($this->params);
$this->assertTrue(true);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment