/** * Check if the current user have access to the given project * * @access protected * @param integer $project_id Project id */ protected function checkProjectPermissions($project_id) { if ($this->acl->isRegularUser()) { if ($project_id > 0 && !$this->project->isUserAllowed($project_id, $this->acl->getUserId())) { $this->response->redirect('?controller=project&action=forbidden'); } } }
public function testIsUser() { $acl = new Acl($this->container); $_SESSION = array(); $this->assertFalse($acl->isRegularUser()); $_SESSION = array('user' => array()); $this->assertFalse($acl->isRegularUser()); $_SESSION = array('user' => array('is_admin' => true)); $this->assertFalse($acl->isRegularUser()); $_SESSION = array('user' => array('is_admin' => true)); $this->assertFalse($acl->isRegularUser()); $_SESSION = array('user' => array('is_admin' => '2')); $this->assertFalse($acl->isRegularUser()); $_SESSION = array('user' => array('is_admin' => false)); $this->assertTrue($acl->isRegularUser()); }