示例#1
0
 public static function getAllowedAction($controllerId, $role_id)
 {
     //TODO: Using cache to speed process
     $output = [];
     foreach (Action::find()->where(["controller_id" => $controllerId])->all() as $action) {
         //bypass for super admin
         if ($role_id == 1) {
             $output[] = $action->action_id;
         } else {
             $roleAction = RoleAction::find()->where(["action_id" => $action->id, "role_id" => $role_id])->one();
             if ($roleAction) {
                 $output[] = $action->action_id;
             }
         }
     }
     return $output;
 }