Commit f24454a4 by Daniel Schmidt

Renames AccessDeniedHttpException to ForbiddenHttpException in framework, docs, and extension files

parent 20e031c8
...@@ -248,7 +248,7 @@ public function editArticle($id) ...@@ -248,7 +248,7 @@ public function editArticle($id)
throw new NotFoundHttpException; throw new NotFoundHttpException;
} }
if (!\Yii::$app->user->checkAccess('edit_article', ['article' => $article])) { if (!\Yii::$app->user->checkAccess('edit_article', ['article' => $article])) {
throw new AccessDeniedHttpException; throw new ForbiddenHttpException;
} }
// ... // ...
} }
......
...@@ -10,7 +10,7 @@ namespace yii\debug; ...@@ -10,7 +10,7 @@ namespace yii\debug;
use Yii; use Yii;
use yii\base\Application; use yii\base\Application;
use yii\web\View; use yii\web\View;
use yii\web\AccessDeniedHttpException; use yii\web\ForbiddenHttpException;
/** /**
* The Yii Debug Module provides the debug toolbar and debugger * The Yii Debug Module provides the debug toolbar and debugger
...@@ -80,7 +80,7 @@ class Module extends \yii\base\Module ...@@ -80,7 +80,7 @@ class Module extends \yii\base\Module
} elseif ($action->id === 'toolbar') { } elseif ($action->id === 'toolbar') {
return false; return false;
} else { } else {
throw new AccessDeniedHttpException('You are not allowed to access this page.'); throw new ForbiddenHttpException('You are not allowed to access this page.');
} }
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace yii\gii; namespace yii\gii;
use Yii; use Yii;
use yii\web\AccessDeniedHttpException; use yii\web\ForbiddenHttpException;
/** /**
* This is the main module class for the Gii module. * This is the main module class for the Gii module.
...@@ -110,7 +110,7 @@ class Module extends \yii\base\Module ...@@ -110,7 +110,7 @@ class Module extends \yii\base\Module
if ($this->checkAccess()) { if ($this->checkAccess()) {
return parent::beforeAction($action); return parent::beforeAction($action);
} else { } else {
throw new AccessDeniedHttpException('You are not allowed to access this page.'); throw new ForbiddenHttpException('You are not allowed to access this page.');
} }
} }
......
...@@ -196,7 +196,7 @@ return [ ...@@ -196,7 +196,7 @@ return [
'yii\validators\ValidationAsset' => YII_PATH . '/validators/ValidationAsset.php', 'yii\validators\ValidationAsset' => YII_PATH . '/validators/ValidationAsset.php',
'yii\validators\Validator' => YII_PATH . '/validators/Validator.php', 'yii\validators\Validator' => YII_PATH . '/validators/Validator.php',
'yii\web\AccessControl' => YII_PATH . '/web/AccessControl.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\AccessRule' => YII_PATH . '/web/AccessRule.php',
'yii\web\Application' => YII_PATH . '/web/Application.php', 'yii\web\Application' => YII_PATH . '/web/Application.php',
'yii\web\AssetBundle' => YII_PATH . '/web/AssetBundle.php', 'yii\web\AssetBundle' => YII_PATH . '/web/AssetBundle.php',
......
...@@ -130,14 +130,14 @@ class AccessControl extends ActionFilter ...@@ -130,14 +130,14 @@ class AccessControl extends ActionFilter
* The default implementation will redirect the user to the login page if he is a guest; * 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. * if the user is already logged, a 403 HTTP exception will be thrown.
* @param User $user the current user * @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) protected function denyAccess($user)
{ {
if ($user->getIsGuest()) { if ($user->getIsGuest()) {
$user->loginRequired(); $user->loginRequired();
} else { } 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.'));
} }
} }
} }
...@@ -323,7 +323,7 @@ class User extends Component ...@@ -323,7 +323,7 @@ class User extends Component
* Note that when [[loginUrl]] is set, calling this method will NOT terminate the application execution. * Note that when [[loginUrl]] is set, calling this method will NOT terminate the application execution.
* *
* @return Response the redirection response if [[loginUrl]] is set * @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() public function loginRequired()
{ {
...@@ -334,7 +334,7 @@ class User extends Component ...@@ -334,7 +334,7 @@ class User extends Component
if ($this->loginUrl !== null) { if ($this->loginUrl !== null) {
return Yii::$app->getResponse()->redirect($this->loginUrl); return Yii::$app->getResponse()->redirect($this->loginUrl);
} else { } else {
throw new AccessDeniedHttpException(Yii::t('yii', 'Login Required')); throw new ForbiddenHttpException(Yii::t('yii', 'Login Required'));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment