Exemplo n.º 1
0
 /**
  * Displays a single Note model.
  * @param $id
  * @return string
  * @throws ForbiddenHttpException
  * @throws NotFoundHttpException
  */
 public function actionView($id)
 {
     $model = $this->findModel($id);
     $result = Access::checkAccess($model);
     if ($result) {
         switch ($result) {
             case Access::ACCESS_CREATOR:
                 return $this->render('viewCreator', ['model' => $model]);
                 break;
             case Access::ACCESS_GUEST:
                 return $this->render('viewGuest', ['model' => $model]);
                 break;
         }
     }
     throw new ForbiddenHttpException("Not allowed! ");
 }