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
05182207
Commit
05182207
authored
Jun 24, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes issue #579: AccessControl deny rule by default
parent
36655d3b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
upgrade-from-v1.md
docs/guide/upgrade-from-v1.md
+0
-1
AccessControl.php
framework/yii/web/AccessControl.php
+3
-3
No files found.
docs/guide/upgrade-from-v1.md
View file @
05182207
...
@@ -288,7 +288,6 @@ public function behaviors()
...
@@ -288,7 +288,6 @@ public function behaviors()
'class'
=>
'yii\web\AccessControl'
,
'class'
=>
'yii\web\AccessControl'
,
'rules'
=>
array
(
'rules'
=>
array
(
array
(
'allow'
=>
true
,
'actions'
=>
array
(
'admin'
),
'roles'
=>
array
(
'@'
)),
array
(
'allow'
=>
true
,
'actions'
=>
array
(
'admin'
),
'roles'
=>
array
(
'@'
)),
array
(
'allow'
=>
false
),
),
),
),
),
);
);
...
...
framework/yii/web/AccessControl.php
View file @
05182207
...
@@ -17,7 +17,7 @@ use yii\base\ActionFilter;
...
@@ -17,7 +17,7 @@ use yii\base\ActionFilter;
* AccessControl is an action filter. It will check its [[rules]] to find
* AccessControl is an action filter. It will check its [[rules]] to find
* the first rule that matches the current context variables (such as user IP address, user role).
* the first rule that matches the current context variables (such as user IP address, user role).
* The matching rule will dictate whether to allow or deny the access to the requested controller
* The matching rule will dictate whether to allow or deny the access to the requested controller
* action.
* action.
If no rule matches, the access will be denied.
*
*
* To use AccessControl, declare it in the `behaviors()` method of your controller class.
* To use AccessControl, declare it in the `behaviors()` method of your controller class.
* For example, the following declarations will allow authenticated users to access the "create"
* For example, the following declarations will allow authenticated users to access the "create"
...
@@ -105,7 +105,7 @@ class AccessControl extends ActionFilter
...
@@ -105,7 +105,7 @@ class AccessControl extends ActionFilter
/** @var $rule AccessRule */
/** @var $rule AccessRule */
foreach
(
$this
->
rules
as
$rule
)
{
foreach
(
$this
->
rules
as
$rule
)
{
if
(
$allow
=
$rule
->
allows
(
$action
,
$user
,
$request
))
{
if
(
$allow
=
$rule
->
allows
(
$action
,
$user
,
$request
))
{
break
;
return
true
;
}
elseif
(
$allow
===
false
)
{
}
elseif
(
$allow
===
false
)
{
if
(
isset
(
$rule
->
denyCallback
))
{
if
(
isset
(
$rule
->
denyCallback
))
{
call_user_func
(
$rule
->
denyCallback
,
$rule
);
call_user_func
(
$rule
->
denyCallback
,
$rule
);
...
@@ -117,7 +117,7 @@ class AccessControl extends ActionFilter
...
@@ -117,7 +117,7 @@ class AccessControl extends ActionFilter
return
false
;
return
false
;
}
}
}
}
return
tru
e
;
return
fals
e
;
}
}
/**
/**
...
...
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