He there,
I've been using the restfullyii extension for a while now, and everything is working great. (http://www.yiiframework.com/extension/restfullyii/)
I was just wondering if the following is possible:
accessRules is looking like this:
public function accessRules()
{
return array(
array('allow',
'actions'=>array('REST.GET.SPECIAL'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' actions
'actions'=>array('REST.GET', 'REST.PUT', 'REST.POST', 'REST.DELETE'),
'users'=>Yii::app()->getModule('user')->getAdmins(),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
restEvents is looking like this:
public function restEvents()
{
$this->onRest('req.get.special.render', function() {
/// blabla code
});
}
I can't seem to find it in the documentation.
Thanks a lot!
I figured it out with the following:
/**
* req.auth.uri
*
* return true to allow access to a given uri / http verb;
* false to deny access to a given uri / http verb;
*
* @return (bool) default is true
*/
$this->onRest(req.auth.uri, function($uri, $verb) {
return true;
});
This will allow you to block/allow particular users in the controller. Just put it in the restEvents() method.