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
66842a48
Commit
66842a48
authored
Apr 16, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes test break.
parent
14b782cf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
AccessControl.php
framework/filters/AccessControl.php
+2
-2
BaseManager.php
framework/rbac/BaseManager.php
+4
-2
Rule.php
framework/rbac/Rule.php
+2
-2
No files found.
framework/filters/AccessControl.php
View file @
66842a48
...
...
@@ -65,8 +65,8 @@ class AccessControl extends ActionFilter
* function ($rule, $action)
* ~~~
*
* where `$rule` is th
is rule
, and `$action` is the current [[Action|action]] object.
* `$rule`
will
be `null` if access is denied because none of the rules matched.
* where `$rule` is th
e rule that denies the user
, and `$action` is the current [[Action|action]] object.
* `$rule`
can
be `null` if access is denied because none of the rules matched.
*/
public
$denyCallback
;
/**
...
...
framework/rbac/BaseManager.php
View file @
66842a48
...
...
@@ -190,19 +190,21 @@ abstract class BaseManager extends Component implements ManagerInterface
* If the item does not specify a rule, this method will return true. Otherwise, it will
* return the value of [[Rule::execute()]].
*
* @param string|integer $user the user ID. This should be either an integer or a string representing
* the unique identifier of a user. See [[\yii\web\User::id]].
* @param Item $item the auth item that needs to execute its rule
* @param array $params parameters passed to [[ManagerInterface::checkAccess()]] and will be passed to the rule
* @return boolean the return value of [[Rule::execute()]]. If the auth item does not specify a rule, true will be returned.
* @throws InvalidConfigException if the auth item has an invalid rule.
*/
protected
function
executeRule
(
$item
,
$params
)
protected
function
executeRule
(
$
user
,
$
item
,
$params
)
{
if
(
$item
->
ruleName
===
null
)
{
return
true
;
}
$rule
=
$this
->
getRule
(
$item
->
ruleName
);
if
(
$rule
instanceof
Rule
)
{
return
$rule
->
execute
(
$item
,
$params
);
return
$rule
->
execute
(
$
user
,
$
item
,
$params
);
}
else
{
throw
new
InvalidConfigException
(
"Rule not found:
{
$item
->
ruleName
}
"
);
}
...
...
framework/rbac/Rule.php
View file @
66842a48
...
...
@@ -35,8 +35,8 @@ abstract class Rule extends Object
*
* @param string|integer $user the user ID. This should be either an integer or a string representing
* the unique identifier of a user. See [[\yii\web\User::id]].
* @param Item $item the
auth item
that this rule is associated with
* @param array $params parameters passed to [[ManagerInterface::
allow
()]].
* @param Item $item the
role or permission
that this rule is associated with
* @param array $params parameters passed to [[ManagerInterface::
checkAccess
()]].
* @return boolean a value indicating whether the rule permits the auth item it is associated with.
*/
abstract
public
function
execute
(
$user
,
$item
,
$params
);
...
...
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