/** * @param string|integer $user the user ID. * @param Item $item the role or permission that this rule is associated with * @param array $params parameters passed to ManagerInterface::checkAccess(). * @return boolean a value indicating whether the rule permits the role or permission it is associated with. */ public function execute($user, $item, $params) { $areaPersonal = AreaPersonal::findOne($params['id_area'], $user); if ($areaPersonal != NULL) { return true; } return false; }
/** * Finds the AreaPersonal model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $area_id * @param string $user_id * @return AreaPersonal the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($area_id, $user_id) { if (($model = AreaPersonal::findOne(['area_id' => $area_id, 'user_id' => $user_id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }