/php
Created
July 4, 2013 04:06
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I saw in upgrading to 1.6 that REST was rebuilt to have internal auth checks. Before I would just do some work around logic in the router controller but from what I read you can set a method internally that should return a bool value? I can't get the response to here is a simplified example of a rest controller | |
class Controller_Rest_Public extends Controller_Rest | |
{ | |
protected $format = 'json'; | |
protected $auth = 'warden'; | |
private $success = false; | |
private $code = 200; | |
private $message = null; | |
private $data = array(); | |
public function before() | |
{ | |
parent::before(); | |
} | |
protected function warden() | |
{ | |
//perform logic | |
return true; | |
} | |
public function after($response) | |
{ | |
return $this->response(array('success' => $this->success, 'message' => $this->message, 'data' => $this->data), $this->code); | |
} | |
public function post_check_api() | |
{ | |
$this->success = true; | |
$this->message = 'API OK'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment