PHRAS-1972: Account Page, Allow a Phraseanet User to delete his account and associated datas (#2918)

* allow user to delete account

* generate translation and add checkbox in the windows confirmation

* change text an configuration key

* update delete account fonctionality

* rename variable

* write in explicite condition

* merge yarn.lock

* regenerate translation
This commit is contained in:
aynsix
2019-04-08 16:25:17 +04:00
committed by jygaulier
parent 4bb3e28bf5
commit 5cdf473c7f
27 changed files with 1258 additions and 304 deletions

View File

@@ -19,6 +19,7 @@ class RepositoriesServiceProviderTest extends ServiceProviderTestCase
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.baskets', 'Alchemy\Phrasea\Model\Repositories\BasketRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.basket-elements', 'Alchemy\Phrasea\Model\Repositories\BasketElementRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.validation-participants', 'Alchemy\Phrasea\Model\Repositories\ValidationParticipantRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.validation-session', 'Alchemy\Phrasea\Model\Repositories\ValidationSessionRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.story-wz', 'Alchemy\Phrasea\Model\Repositories\StoryWZRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.orders', 'Alchemy\Phrasea\Model\Repositories\OrderRepository'],
['Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider', 'repo.order-elements', 'Alchemy\Phrasea\Model\Repositories\OrderElementRepository'],

View File

@@ -0,0 +1,66 @@
<?php
namespace Alchemy\Tests\Phrasea\Notification\Mail;
use Alchemy\Phrasea\Exception\LogicException;
use Alchemy\Phrasea\Notification\Mail\MailRequestAccountDelete;
/**
* @group functional
* @group legacy
* @covers Alchemy\Phrasea\Notification\Mail\MailRequestAccountDelete
*/
class MailRequestAccountDeleteTest extends MailWithLinkTestCase
{
/**
* @covers Alchemy\Phrasea\Notification\Mail\MailRequestAccountDelete::setUserOwner
*/
public function testSetUserOwner()
{
$this->assertEquals('Email:deletion:request:message Hello %civility% %firstName% %lastName%.
We have received an account deletion request for your account on %urlInstance%, please confirm this deletion by clicking on the link below.
If you are not at the origin of this request, please change your password as soon as possible %resetPassword%
Link is valid for one hour.', $this->getMail()->getMessage());
}
public function testShouldThrowALogicExceptionIfNoUserProvided()
{
$mail = MailRequestAccountDelete::create(
$this->getApplication(),
$this->getReceiverMock(),
$this->getEmitterMock(),
$this->getMessage(),
$this->getUrl(),
$this->getExpiration()
);
try {
$mail->getMessage();
$this->fail('Should have raised an exception');
} catch (LogicException $e) {
}
}
public function getMail()
{
$mail = MailRequestAccountDelete::create(
$this->getApplication(),
$this->getReceiverMock(),
$this->getEmitterMock(),
$this->getMessage(),
$this->getUrl(),
$this->getExpiration()
);
$user = $this->createUserMock();
$user->expects($this->any())
->method('getDisplayName')
->will($this->returnValue('JeanPhil'));
$mail->setUserOwner($user);
return $mail;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Alchemy\Tests\Phrasea\Notification\Mail;
use Alchemy\Phrasea\Notification\Mail\MailSuccessAccountDelete;
/**
* @group functional
* @group legacy
* @covers Alchemy\Phrasea\Notification\Mail\MailSuccessAccountDelete
*/
class MailSuccessAccountDeleteTest extends MailTestCase
{
public function getMail()
{
return MailSuccessAccountDelete::create(
$this->getApplication(),
$this->getReceiverMock(),
$this->getEmitterMock(),
$this->getMessage()
);
}
}