示例#1
0
 /**
  * Updates an existing AuthItem model.
  * If update is successful, the browser will be redirected to the 'view' page.
  *
  * @param string $id        	
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post())) {
         $item = $this->model2Item($model, new Permission());
         $this->auth->update($id, $item);
         return $this->redirect(['index']);
     } else {
         $locals = [];
         $locals['groups'] = YiiForum::getAppParam('cachedPermissionsGroup');
         $parent = AuthItem::getAuthItemParent($id);
         if ($parent) {
             $model->category = $parent;
         }
         $locals['model'] = $model;
         return $this->render('update', $locals);
     }
 }