Skip to content

Commit

Permalink
Renames AccessDeniedHttpException to ForbiddenHttpException in framew…
Browse files Browse the repository at this point in the history
…ork, docs, and extension files
  • Loading branch information
danschmidt5189 committed Jan 22, 2014
1 parent 20e031c commit f24454a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/guide/authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function editArticle($id)
throw new NotFoundHttpException;
}
if (!\Yii::$app->user->checkAccess('edit_article', ['article' => $article])) {
throw new AccessDeniedHttpException;
throw new ForbiddenHttpException;
}
// ...
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/debug/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Yii;
use yii\base\Application;
use yii\web\View;
use yii\web\AccessDeniedHttpException;
use yii\web\ForbiddenHttpException;

/**
* The Yii Debug Module provides the debug toolbar and debugger
Expand Down Expand Up @@ -80,7 +80,7 @@ public function beforeAction($action)
} elseif ($action->id === 'toolbar') {
return false;
} else {
throw new AccessDeniedHttpException('You are not allowed to access this page.');
throw new ForbiddenHttpException('You are not allowed to access this page.');
}
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/gii/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace yii\gii;

use Yii;
use yii\web\AccessDeniedHttpException;
use yii\web\ForbiddenHttpException;

/**
* This is the main module class for the Gii module.
Expand Down Expand Up @@ -110,7 +110,7 @@ public function beforeAction($action)
if ($this->checkAccess()) {
return parent::beforeAction($action);
} else {
throw new AccessDeniedHttpException('You are not allowed to access this page.');
throw new ForbiddenHttpException('You are not allowed to access this page.');
}
}

Expand Down
2 changes: 1 addition & 1 deletion framework/classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
'yii\validators\ValidationAsset' => YII_PATH . '/validators/ValidationAsset.php',
'yii\validators\Validator' => YII_PATH . '/validators/Validator.php',
'yii\web\AccessControl' => YII_PATH . '/web/AccessControl.php',
'yii\web\AccessDeniedHttpException' => YII_PATH . '/web/AccessDeniedHttpException.php',
'yii\web\ForbiddenHttpException' => YII_PATH . '/web/ForbiddenHttpException.php',
'yii\web\AccessRule' => YII_PATH . '/web/AccessRule.php',
'yii\web\Application' => YII_PATH . '/web/Application.php',
'yii\web\AssetBundle' => YII_PATH . '/web/AssetBundle.php',
Expand Down
4 changes: 2 additions & 2 deletions framework/web/AccessControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ public function beforeAction($action)
* The default implementation will redirect the user to the login page if he is a guest;
* if the user is already logged, a 403 HTTP exception will be thrown.
* @param User $user the current user
* @throws AccessDeniedHttpException if the user is already logged in.
* @throws ForbiddenHttpException if the user is already logged in.
*/
protected function denyAccess($user)
{
if ($user->getIsGuest()) {
$user->loginRequired();
} else {
throw new AccessDeniedHttpException(Yii::t('yii', 'You are not allowed to perform this action.'));
throw new ForbiddenHttpException(Yii::t('yii', 'You are not allowed to perform this action.'));
}
}
}
4 changes: 2 additions & 2 deletions framework/web/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public function setReturnUrl($url)
* Note that when [[loginUrl]] is set, calling this method will NOT terminate the application execution.
*
* @return Response the redirection response if [[loginUrl]] is set
* @throws AccessDeniedHttpException the "Access Denied" HTTP exception if [[loginUrl]] is not set
* @throws ForbiddenHttpException the "Access Denied" HTTP exception if [[loginUrl]] is not set
*/
public function loginRequired()
{
Expand All @@ -334,7 +334,7 @@ public function loginRequired()
if ($this->loginUrl !== null) {
return Yii::$app->getResponse()->redirect($this->loginUrl);
} else {
throw new AccessDeniedHttpException(Yii::t('yii', 'Login Required'));
throw new ForbiddenHttpException(Yii::t('yii', 'Login Required'));
}
}

Expand Down

0 comments on commit f24454a

Please sign in to comment.