Advertisement
fernandezekiel

Untitled

Jan 6th, 2013
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. public static function mayGenerally($model_object, $action) {
  2.         $user = self::getUser();
  3.         $model_class = get_class($model_object);
  4.         $authItem = self::createAuthItem($action, 'any', $model_class);
  5.         if ($model_object->autoAuthItemMatch == false) {
  6.             $accessRules = $model_object->accessRules();
  7.             $autItem = $accessRules[$action][$model_object->accessTerms['generalAccessTerm']];
  8.             //this part here is defined by the user in a model in a method called accessRules()
  9.         //what would be the best checking method if the array has been set at all
  10.         }
  11.         if ($user->profile->branch_id == Branch::ROOT_BRANCH && Yii::app()->user->checkAccess($authItem))
  12.             return true;
  13.  
  14.         return false;
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement