/**
  * Deletes an existing Gruppo model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $model = $this->findModel($id);
     if (!User::isAllowed($model)) {
         return $this->render('/site/error', ['name' => 'Access Denied', 'message' => "You don't have request privileges to delete this group."]);
     }
     $model->delete();
     return $this->redirect(['index']);
 }
Example #2
0
 public function beforeAction($action)
 {
     $parentAllowed = parent::beforeAction($action);
     if ($action->id == 'update' || $action->id == 'delete') {
         $model = $this->findModel($_GET['id']);
         if (!User::isAllowed($model)) {
             throw new HttpException(403, "You don't have request privileges to {$action->id} this contact.");
         }
     }
     return $parentAllowed;
 }