/** * @covers User::setGroupId * @covers User::getGroupId */ public function testSetGroupId() { $id = 13; $actual = $this->user->getGroupId(); $this->assertNotEquals($id, $actual); $this->user->setGroupId($id); $actual = $this->user->getGroupId(); $this->assertEquals($id, $actual); }
public function editAction() { if ($this->_hasParam('id')) { $userId = $this->_getParam('id'); if ($this->_request->isPost()) { if ($this->_request->getPost('user')) { $this->changeUser($userId); } if ($this->_request->getPost('addPerm')) { $this->addPermission($userId); } if ($this->_request->getPost('updatePerms')) { $this->updatePermissions($userId); } } $user = new User($userId); $controllers = new ControllersHandler(); $contList = $controllers->getControllersList($this->getSiteId()); $permissions = $this->users->listUserPermissions($userId); foreach ($permissions as $perm) { if (isset($contList['list'][$perm['uc_controller_id']])) { unset($contList['list'][$perm['uc_controller_id']]); } } foreach ($permissions as $key => $value) { if (strstr($value['uc_permission'], 'r')) { $permissions[$key]['read'] = true; } if (strstr($value['uc_permission'], 'w')) { $permissions[$key]['write'] = true; } if (strstr($value['uc_permission'], 'd')) { $permissions[$key]['delete'] = true; } } $this->tplVars['users']['val']['login'] = $user->getLogin(); $this->tplVars['users']['val']['group'] = $user->getGroupId(); $this->tplVars['users']['groupsList'] = $this->users->listGroups(); $this->tplVars['users']['controllers'] = $contList['list']; $this->tplVars['users']['permissions'] = $permissions; $this->tplVars['header']['actions']['names'][] = array('name' => 'edit', 'menu_name' => 'Edit User'); array_push($this->viewIncludes, 'users/usersEdit.tpl'); array_push($this->viewIncludes, 'users/usersPermissions.tpl'); } else { $this->_redirect('/users/list/'); } }