controllers/AuthItemController.php
public function actionUpdate($name)
    {
        /* @var $am CAuthManager|AuthBehavior */
        $am = Yii::app()->getAuthManager();

        $item = $am->getAuthItem($name);

        if ($item === null) {
            throw new CHttpException(404, Yii::t('AuthModule.main', 'Page not found.'));
        }

        $model = new AuthItemForm('update');

        if (isset($_POST['AuthItemForm'])) {
            $model->attributes = $_POST['AuthItemForm'];
            if ($model->validate()) {
                $item->description = $model->description;

                $am->saveAuthItem($item);
                if ($am instanceof CPhpAuthManager) {
                    $am->save();
                }

                $this->redirect(array('index'));
            }
        }

        $model->name = $name;
        $model->description = $item->description;
        $model->type = $item->type;

        $this->render(
            'update',
            array(
                'item' => $item,
                'model' => $model,
            )
        );
    }
public function actionUpdate($name)
    {
        /* @var $am CAuthManager|AuthBehavior */
        $am = Yii::app()->getAuthManager();

        $item = $am->getAuthItem($name);

        if ($item === null) {
            throw new CHttpException(404, Yii::t('AuthModule.main', 'Page not found.'));
        }

        $model = new AuthItemForm('update');

        if (isset($_POST['AuthItemForm'])) {
            $model->attributes = $_POST['AuthItemForm'];
            if ($model->validate()) {
                $item->description = $model->description;

                $am->saveAuthItem($item);
                if ($am instanceof CPhpAuthManager) {
                    $am->save();
                }

                $this->redirect(array('index'));
            }
        }

        $model->name = $name;
        $model->description = $item->description;
        $model->type = $item->type;

        $this->render(
            'update',
            array(
                'item' => $item,
                'model' => $model,
            )
        );
    }
public function actionUpdate ( $ name ) { /* @var $am CAuthManager|AuthBehavior */ $ am = Yii :: app ( ) -> getAuthManager ( ) ; $ item = $ am -> getAuthItem ( $ name ) ; if ( $ item === null ) { throw new CHttpException ( 404 , Yii :: t ( 'AuthModule.main' , 'Page not found.' ) ) ; } $ model = new AuthItemForm ( 'update' ) ; if ( isset ( $ _POST [ 'AuthItemForm' ] ) ) { $ model -> attributes = $ _POST [ 'AuthItemForm' ] ; if ( $ model -> validate ( ) ) { $ item -> description = $ model -> description ; $ am -> saveAuthItem ( $ item ) ; if ( $ am instanceof CPhpAuthManager ) { $ am -> save ( ) ; } $ this -> redirect ( array ( 'index' ) ) ; } } $ model -> name = $ name ; $ model -> description = $ item -> description ; $ model -> type = $ item -> type ; $ this -> render ( 'update' , array ( 'item' => $ item , 'model' => $ model , ) ) ; }
Displays a form for updating the item with the given name.
@param string $name name of the item.
@throws CHttpException if the authorization item is not found.
Displays a form for updating the item with the given name .