From f57b716d349a5cf33dbe3e41dff2976427ac9f33 Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-loas.afi-sa.net> Date: Thu, 20 Feb 2014 12:46:29 +0100 Subject: [PATCH] rel #9979 you can edit role level of a SIGB subscriber -> issue: duplicat user in db --- application/modules/admin/views/scripts/users/_form.phtml | 2 +- library/ZendAfi/Acl/AdminControllerRoles.php | 2 -- .../modules/admin/controllers/UsersControllerTest.php | 6 ++++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/application/modules/admin/views/scripts/users/_form.phtml b/application/modules/admin/views/scripts/users/_form.phtml index 17717172c4e..d91375afb87 100644 --- a/application/modules/admin/views/scripts/users/_form.phtml +++ b/application/modules/admin/views/scripts/users/_form.phtml @@ -55,7 +55,7 @@ if ($this->user->getId() == '1') echo '<select disabled="disabled"><option selected="selected" value="7">super_admin</option></select><input type="hidden" value="7" name="role" id="role"/>'; else - print $comboListeRole->rendCombo($this->user->getRole(),$this->authUser->ROLE_LEVEL); + print $this->user->getRoleLevel() != 2 ? $comboListeRole->rendCombo($this->user->getRole(),$this->authUser->ROLE_LEVEL) : ZendAfi_Acl_AdminControllerRoles::getLibelleRole(2); ; ?> </td> diff --git a/library/ZendAfi/Acl/AdminControllerRoles.php b/library/ZendAfi/Acl/AdminControllerRoles.php index 8a9862ff9ca..f71fbfa4aeb 100644 --- a/library/ZendAfi/Acl/AdminControllerRoles.php +++ b/library/ZendAfi/Acl/AdminControllerRoles.php @@ -152,8 +152,6 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl { //---------------------------------------------------------------------------------- public static function rendCombo($selected,$user_role_level,$tous=false) { - if($selected=='abonne_sigb') - return self::getLibelleRole(2); $html[]='<select name="role">'; if($tous==true) diff --git a/tests/application/modules/admin/controllers/UsersControllerTest.php b/tests/application/modules/admin/controllers/UsersControllerTest.php index 3cd9cb364e8..9d0941b9274 100644 --- a/tests/application/modules/admin/controllers/UsersControllerTest.php +++ b/tests/application/modules/admin/controllers/UsersControllerTest.php @@ -91,6 +91,12 @@ class UsersControllerIndexTest extends UsersControllerWithMarcusTestCase { public function formShouldContainsInputForNom() { $this->assertXPath('//input[@name="nom"]'); } + + + /** @test */ + public function formShouldContainsRoleSelect() { + $this->assertXPath('//select[@name="role"]'); + } } -- GitLab