public function loadModel($id) { if (($model = Release::findOne($id)) === null) { throw new yii\web\NotFoundHttpException('Release not found'); } if (!Yii::$app->user->can('managementReleases') && !$model->isPublished() || !Yii::$app->user->can('viewProjectModReleases', ['mod' => $model->mod])) { throw new yii\web\ForbiddenHttpException(); } return $model; }
public function loadModel($id, $group = null, $project = null, $mod = null) { if (($model = Release::findOne($id)) === null) { throw new NotFoundHttpException('Release not found'); } if ($group !== null && $project !== null && $mod !== null) { if ($mod == 'default') { $mod = null; } if ($model->mod->alias != $mod || $model->mod->project->alias != $project || $model->mod->project->group->alias != $group) { throw new NotFoundHttpException('Release not found'); } } return $model; }