Created
December 23, 2012 21:40
-
-
Save crisu83/4366301 to your computer and use it in GitHub Desktop.
A single action from a work in progress AuthItemController.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function actionDelete() | |
{ | |
$request = Yii::app()->request; | |
if ($request->isPostRequest && isset($_GET['name'])) | |
{ | |
$name = $_GET['name']; | |
/* @var $am CAuthManager|AuthBehavior */ | |
$am = Yii::app()->getAuthManager(); | |
$item = $am->getAuthItem($name); | |
$type = $item->getType(); | |
if ($item instanceof CAuthItem) | |
$am->removeAuthItem($name); | |
if (!$request->isAjaxRequest) | |
$this->redirect(array('index', 'type'=>$type)); | |
} | |
else | |
throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment