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 {
->setAttrib('style', 'position: relative')
->setMethod('get');
$names = [];
foreach($this->_criteria as $criteria) {
if (!$element = $criteria->getElement())
continue;
$form->addElement($criteria->getElement());
$names[] = $criteria->getName();
}
$names = (new Storm_Collection($this->_criteria))
->select(function($c) { return $c->getElement(); })
->eachDo(function($c) use ($form) { $form->addElement($c->getElement()); })
->collect(function($c) { return $c->getName(); })
->getArrayCopy();
if (!$names)
return $form;
$form->addDisplayGroup($names,
'search_group',
......
......@@ -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;
public function setUp() {
......@@ -1068,15 +1068,6 @@ abstract class UsersControllerWithAdminPortal extends Admin_AbstractControllerTe
'login' => 'tim',
'password' => 'rim',
'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]));
}
}
class UsersControllerIndexWithAdminPortal extends UsersControllerWithAdminPortal {
public function setUp() {
parent::setUp();
$this->onLoaderOfModel('Class_Users')
->whenCalled('findAllBy')
......@@ -1088,31 +1079,20 @@ class UsersControllerIndexWithAdminPortal extends UsersControllerWithAdminPortal
->with(['where' => '(role_level <= ' . ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL . ')'])
->answers(1)
;
$this->dispatch('/admin/users', true);
}
/** @test */
public function superAdminEditLinkShouldNotBePresent() {
public function superAdminEditLinkShouldNotBePresentInIndex() {
$this->dispatch('/admin/users', true);
$this->assertNotXPath('//a[contains(@href, "/users/edit/id/1")]',
$this->_response->getBody());
}
}
class UsersControllerEditSuperAdminWithAdminPortal extends UsersControllerWithAdminPortal {
public function setUp() {
parent::setUp();
$this->dispatch('/admin/users/edit/id/1', true);
}
/** @test */
public function shouldRedirectToIndex() {
public function tryingToEditSuperAdminshouldRedirectToIndex() {
$this->dispatch('/admin/users/edit/id/1', true);
$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