mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Clear log repository on user deletion
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Model\Manager;
|
namespace Alchemy\Phrasea\Model\Manager;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Model\Entities\ApiLog;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
use Alchemy\Phrasea\Model\Entities\User;
|
use Alchemy\Phrasea\Model\Entities\User;
|
||||||
use Alchemy\Phrasea\Model\Entities\UserSetting;
|
use Alchemy\Phrasea\Model\Entities\UserSetting;
|
||||||
@@ -44,7 +45,7 @@ class UserManager
|
|||||||
* Deletes an user.
|
* Deletes an user.
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param type $flush
|
* @param bool $flush
|
||||||
*/
|
*/
|
||||||
public function delete(User $user, $flush = true)
|
public function delete(User $user, $flush = true)
|
||||||
{
|
{
|
||||||
@@ -52,8 +53,10 @@ class UserManager
|
|||||||
$this->cleanRights($user);
|
$this->cleanRights($user);
|
||||||
|
|
||||||
$this->objectManager->persist($user);
|
$this->objectManager->persist($user);
|
||||||
|
|
||||||
if ($flush) {
|
if ($flush) {
|
||||||
$this->objectManager->flush();
|
$this->objectManager->flush();
|
||||||
|
$this->objectManager->clear(ApiLog::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,11 +64,12 @@ class UserManager
|
|||||||
* Updates an user.
|
* Updates an user.
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param type $flush
|
* @param bool $flush
|
||||||
*/
|
*/
|
||||||
public function update(User $user, $flush = true)
|
public function update(User $user, $flush = true)
|
||||||
{
|
{
|
||||||
$this->objectManager->persist($user);
|
$this->objectManager->persist($user);
|
||||||
|
|
||||||
if ($flush) {
|
if ($flush) {
|
||||||
$this->objectManager->flush();
|
$this->objectManager->flush();
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ class UserDeletionTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
$apiLog = $apiLogManipulator->create($account, new Request(), new Response());
|
$apiLog = $apiLogManipulator->create($account, new Request(), new Response());
|
||||||
$apiLogId = $apiLog->getId();
|
$apiLogId = $apiLog->getId();
|
||||||
|
|
||||||
$this->userManipulator->delete($this->user);
|
$this->userManipulator->delete($this->user, true);
|
||||||
$this->assertTrue($this->user->isDeleted(), 'User was not properly deleted');
|
$this->assertTrue($this->user->isDeleted(), 'User was not properly deleted');
|
||||||
|
|
||||||
$apiLogRepository->clear();
|
$apiLogRepository->clear();
|
||||||
|
Reference in New Issue
Block a user