AccessControl.php 335 Bytes
<?php
/**
 * This class controls requests to the API
 * All request those are from guest must be rejected
 */
class AccessControl extends CFilter
{
    protected function preFilter($filterChain)
    {
    	if(Yii::app()->user->isGuest) {
    		throw new CHttpException(401, 'Unauthorized request');
    	}
        return true;
    }
}