Skip to content
Snippets Groups Projects
Commit 0f7bc64c authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

hotline #59056 : fix rt

parent b2d714d7
Branches
Tags
2 merge requests!2334Master,!2110hotline #59056 : user administration limited to current role level and under
Pipeline #1091 passed with stage
in 12 minutes and 45 seconds
...@@ -64,14 +64,14 @@ class Class_User_SearchCriteria { ...@@ -64,14 +64,14 @@ class Class_User_SearchCriteria {
->setAttrib('style', 'position: relative') ->setAttrib('style', 'position: relative')
->setMethod('get'); ->setMethod('get');
$names = []; $names = (new Storm_Collection($this->_criteria))
foreach($this->_criteria as $criteria) { ->select(function($c) { return $c->getElement(); })
if (!$element = $criteria->getElement()) ->eachDo(function($c) use ($form) { $form->addElement($c->getElement()); })
continue; ->collect(function($c) { return $c->getName(); })
->getArrayCopy();
$form->addElement($criteria->getElement());
$names[] = $criteria->getName(); if (!$names)
} return $form;
$form->addDisplayGroup($names, $form->addDisplayGroup($names,
'search_group', 'search_group',
......
...@@ -1050,7 +1050,7 @@ class Admin_UsersControllerChangeAdminSkinActionTest extends Admin_AbstractContr ...@@ -1050,7 +1050,7 @@ class Admin_UsersControllerChangeAdminSkinActionTest extends Admin_AbstractContr
abstract class UsersControllerWithAdminPortal extends Admin_AbstractControllerTestCase { class UsersControllerWithAdminPortalTest extends Admin_AbstractControllerTestCase {
protected $_storm_default_to_volatile = true; protected $_storm_default_to_volatile = true;
public function setUp() { public function setUp() {
...@@ -1068,15 +1068,6 @@ abstract class UsersControllerWithAdminPortal extends Admin_AbstractControllerTe ...@@ -1068,15 +1068,6 @@ abstract class UsersControllerWithAdminPortal extends Admin_AbstractControllerTe
'login' => 'tim', 'login' => 'tim',
'password' => 'rim', 'password' => 'rim',
'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL])); 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]));
}
}
class UsersControllerIndexWithAdminPortal extends UsersControllerWithAdminPortal {
public function setUp() {
parent::setUp();
$this->onLoaderOfModel('Class_Users') $this->onLoaderOfModel('Class_Users')
->whenCalled('findAllBy') ->whenCalled('findAllBy')
...@@ -1088,31 +1079,20 @@ class UsersControllerIndexWithAdminPortal extends UsersControllerWithAdminPortal ...@@ -1088,31 +1079,20 @@ class UsersControllerIndexWithAdminPortal extends UsersControllerWithAdminPortal
->with(['where' => '(role_level <= ' . ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL . ')']) ->with(['where' => '(role_level <= ' . ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL . ')'])
->answers(1) ->answers(1)
; ;
$this->dispatch('/admin/users', true);
} }
/** @test */ /** @test */
public function superAdminEditLinkShouldNotBePresent() { public function superAdminEditLinkShouldNotBePresentInIndex() {
$this->dispatch('/admin/users', true);
$this->assertNotXPath('//a[contains(@href, "/users/edit/id/1")]', $this->assertNotXPath('//a[contains(@href, "/users/edit/id/1")]',
$this->_response->getBody()); $this->_response->getBody());
} }
}
class UsersControllerEditSuperAdminWithAdminPortal extends UsersControllerWithAdminPortal {
public function setUp() {
parent::setUp();
$this->dispatch('/admin/users/edit/id/1', true);
}
/** @test */ /** @test */
public function shouldRedirectToIndex() { public function tryingToEditSuperAdminshouldRedirectToIndex() {
$this->dispatch('/admin/users/edit/id/1', true);
$this->assertRedirectTo('/admin/users/index'); $this->assertRedirectTo('/admin/users/index');
} }
} }
\ No newline at end of file
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