public function before() { parent::before(); $access = Auth_Jam::access($this->request->action(), $this->access); $access_method = 'user_access_by_' . $this->access_method; if ($this->access_method !== self::ACCESS_METHOD_PERMISSION) { $this->access_permission = TRUE; } if ($access === 'private' and $this->access_permission and (!Auth::instance()->logged_in() or !Tart::$access_method(Auth::instance()->get_user(), $this->access_permission, $this->request->uri()))) { if (!Auth::instance()->logged_in()) { $this->notify('warning', 'You must be logged in to access this page'); } else { $this->notify('warning', 'Your user does not have access to "' . $this->request->uri() . '" page'); } Session::instance()->set('requested_url', $this->request->uri()); $this->redirect(Tart::uri('session', 'new')); } $this->template->title = $this->title(); $this->template->sidebar = FALSE; }
/** * @dataProvider data_access */ public function test_access($access, $action, $expected_access) { $this->assertEquals($expected_access, Auth_Jam::access($action, $access)); }
public static function clear_cache() { Auth_Jam::$_instance = NULL; }