/** * @inheritdoc */ public function run($id) { $model = parent::findModel($id); // Check for current user if ($model->user->primaryKey != Yii::$app->user->identity->primaryKey) { throw new ServerErrorHttpException('View this object is forbidden.'); } return $model; }
public function run($id) { $model = parent::run($id); foreach ($this->controller->getFilters() as $column => $value) { if ($model->{$column} != $value) { throw new NotFoundHttpException("Object not found: {$id}"); } } return $model; }
/** * @inheritdoc */ public function actions() { $actions = parent::actions(); $actions['index'] = ['class' => IndexAction::className(), 'modelClass' => $this->modelClass, 'formClass' => $this->indexFormClass, 'checkAccess' => function ($actionName) { AccessActionControl::checkAccess("{$this->permissionPrefix}:index", ['actionName' => $actionName]); }]; $actions['view'] = ['class' => ViewAction::className(), 'modelClass' => $this->modelClass, 'checkAccess' => function ($actionName, $model) { AccessActionControl::checkAccess("{$this->permissionPrefix}:view", ['actionName' => $actionName, 'model' => $model]); }]; $actions['options'] = ['class' => OptionsAction::className()]; return $actions; }
public function run($id) { return parent::run($id); }
/** * @inheritdoc */ public function run() { return parent::run(null); }