mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 10:23:17 +00:00
Merge pull request #763 from romainneutron/fix-1567
[3.8] Fix #1567 : Disallow a user to remove himself from DB
This commit is contained in:
@@ -65,6 +65,9 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
|
||||
public function delete_users()
|
||||
{
|
||||
foreach ($this->users as $usr_id) {
|
||||
if ($this->app['authentication']->getUser()->get_id() === (int) $usr_id) {
|
||||
continue;
|
||||
}
|
||||
$user = \User_Adapter::getInstance($usr_id, $this->app);
|
||||
$this->delete_user($user);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,15 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
}
|
||||
|
||||
public function testRouteDeleteCurrentUserDoesNothing()
|
||||
{
|
||||
self::$DI['client']->request('POST', '/admin/users/delete/', array('users' => self::$DI['user']->get_id()));
|
||||
$response = self::$DI['client']->getResponse();
|
||||
$this->assertTrue($response->isRedirect());
|
||||
|
||||
$this->assertTrue(false !== \User_Adapter::get_usr_id_from_login(self::$DI['app'], self::$DI['user']->get_login()));
|
||||
}
|
||||
|
||||
public function testRouteRightsApply()
|
||||
{
|
||||
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailSuccessEmailUpdate', 2);
|
||||
|
||||
Reference in New Issue
Block a user