/** * Run ACL check and redirect user automatically if user doesn't have the privilege * * @access public * @param mixed $resource * @param string $type */ protected final function _acl($resource, $type = null) { $status = \Hybrid\Acl::access_status($resource, $type); switch ($status) { case 401: \Request::show_404(); break; } }
/** * Run ACL check and redirect user automatically if user doesn't have the privilege * * @final * @access protected * @param mixed $resource * @param string $type * @param string $name * @throws HttpNotFoundException */ protected final function acl($resource, $type = null, $name = null) { $acl = Acl::make($name); $status = $acl->access_status($resource, $type); switch ($status) { case 401: $acl->unauthorized($resource, false); exit; break; } }
/** * Run ACL check and redirect user automatically if user doesn't have the privilege * * @access public * @param mixed $resource * @param string $type */ protected final function _acl($resource, $type = null) { $status = \Hybrid\Acl::access_status($resource, $type); switch ($status) { case 401: $this->response(array('text' => 'You doesn\'t have privilege to do this action'), 401); print $this->response->body; exit; break; } }
/** * Get Hybrid\Acl object, it's a quick way of get and use Hybrid\Acl without having to * initiate another call when this class already has it * * Usage: * * <code>$role = \Hybrid\Auth::make('user')->acl(); * $role->add_recources('monkeys');</code> * * @access public * @param string $name * @return object */ public function acl($name = null) { $this->acl = Acl::make($name); return $this->acl; }