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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
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()
'class'
=>
'yii\web\AccessControl'
,
'rules'
=>
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;
* 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 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.
* For example, the following declarations will allow authenticated users to access the "create"
...
...
@@ -105,7 +105,7 @@ class AccessControl extends ActionFilter
/** @var $rule AccessRule */
foreach
(
$this
->
rules
as
$rule
)
{
if
(
$allow
=
$rule
->
allows
(
$action
,
$user
,
$request
))
{
break
;
return
true
;
}
elseif
(
$allow
===
false
)
{
if
(
isset
(
$rule
->
denyCallback
))
{
call_user_func
(
$rule
->
denyCallback
,
$rule
);
...
...
@@ -117,7 +117,7 @@ class AccessControl extends ActionFilter
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