Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
f24454a4
Commit
f24454a4
authored
Jan 21, 2014
by
Daniel Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renames AccessDeniedHttpException to ForbiddenHttpException in framework, docs, and extension files
parent
20e031c8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
10 deletions
+10
-10
authorization.md
docs/guide/authorization.md
+1
-1
Module.php
extensions/debug/Module.php
+2
-2
Module.php
extensions/gii/Module.php
+2
-2
classes.php
framework/classes.php
+1
-1
AccessControl.php
framework/web/AccessControl.php
+2
-2
User.php
framework/web/User.php
+2
-2
No files found.
docs/guide/authorization.md
View file @
f24454a4
...
@@ -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
AccessDenied
HttpException
;
throw
new
Forbidden
HttpException
;
}
}
// ...
// ...
}
}
...
...
extensions/debug/Module.php
View file @
f24454a4
...
@@ -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\
AccessDenied
HttpException
;
use
yii\web\
Forbidden
HttpException
;
/**
/**
* 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
AccessDenied
HttpException
(
'You are not allowed to access this page.'
);
throw
new
Forbidden
HttpException
(
'You are not allowed to access this page.'
);
}
}
}
}
...
...
extensions/gii/Module.php
View file @
f24454a4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
namespace
yii\gii
;
namespace
yii\gii
;
use
Yii
;
use
Yii
;
use
yii\web\
AccessDenied
HttpException
;
use
yii\web\
Forbidden
HttpException
;
/**
/**
* 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
AccessDenied
HttpException
(
'You are not allowed to access this page.'
);
throw
new
Forbidden
HttpException
(
'You are not allowed to access this page.'
);
}
}
}
}
...
...
framework/classes.php
View file @
f24454a4
...
@@ -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/AccessDenied
HttpException.php'
,
'yii\web\
ForbiddenHttpException'
=>
YII_PATH
.
'/web/Forbidden
HttpException.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'
,
...
...
framework/web/AccessControl.php
View file @
f24454a4
...
@@ -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
AccessDenied
HttpException if the user is already logged in.
* @throws
Forbidden
HttpException 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
AccessDenied
HttpException
(
Yii
::
t
(
'yii'
,
'You are not allowed to perform this action.'
));
throw
new
Forbidden
HttpException
(
Yii
::
t
(
'yii'
,
'You are not allowed to perform this action.'
));
}
}
}
}
}
}
framework/web/User.php
View file @
f24454a4
...
@@ -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
AccessDenied
HttpException the "Access Denied" HTTP exception if [[loginUrl]] is not set
* @throws
Forbidden
HttpException 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
AccessDenied
HttpException
(
Yii
::
t
(
'yii'
,
'Login Required'
));
throw
new
Forbidden
HttpException
(
Yii
::
t
(
'yii'
,
'Login Required'
));
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment