public function __construct() { parent::__construct(); // Only admin users if (!$this->_login() or !$this->_login_admin()) { $this->rest_error(401); return FALSE; } }
public function __construct() { parent::__construct(); // Check auth here if (!$this->_login_admin()) { $this->admin = FALSE; } else { $this->admin = TRUE; } }
function _remap($method) { // if CI gives us "foo", we need to check if "foo_authd_<request_method>" exists. // if so, ensure authentication and pass "foo_authd" to REST controller otherwise // pass the method name unchanged to REST controller for normal processing (including 404) $authd_method = $method . "_authd"; if ($this->rest_method_exists($authd_method)) { if (!$this->social_auth->request_is_signed()) { return $this->response(array('status' => 'error', 'message' => 'Dang, your request is not signed'), 200); } if (!($this->oauth_user_id = $this->social_auth->get_oauth_user_id())) { return $this->response(array('status' => 'error', 'message' => 'Oops, invalid OAuth signature'), 200); } $method = $authd_method; } parent::_remap($method, array()); }