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
ec949395
Commit
ec949395
authored
May 11, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/yiisoft/yii2
parents
51f44243
23e820e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
ManagerTestBase.php
tests/unit/framework/rbac/ManagerTestBase.php
+1
-0
Assignment.php
yii/rbac/Assignment.php
+8
-2
Item.php
yii/rbac/Item.php
+11
-5
No files found.
tests/unit/framework/rbac/ManagerTestBase.php
View file @
ec949395
...
...
@@ -57,6 +57,7 @@ abstract class ManagerTestBase extends TestCase
$this
->
assertTrue
(
$item
instanceof
Item
);
$this
->
assertTrue
(
$this
->
auth
->
hasItemChild
(
'reader'
,
'readPost'
));
$item
->
name
=
'readPost2'
;
$item
->
save
();
$this
->
assertNull
(
$this
->
auth
->
getItem
(
'readPost'
));
$this
->
assertEquals
(
$this
->
auth
->
getItem
(
'readPost2'
),
$item
);
$this
->
assertFalse
(
$this
->
auth
->
hasItemChild
(
'reader'
,
'readPost'
));
...
...
yii/rbac/Assignment.php
View file @
ec949395
...
...
@@ -81,7 +81,6 @@ class Assignment extends Object
{
if
(
$this
->
_bizRule
!==
$value
)
{
$this
->
_bizRule
=
$value
;
$this
->
_auth
->
saveAssignment
(
$this
);
}
}
...
...
@@ -100,7 +99,14 @@ class Assignment extends Object
{
if
(
$this
->
_data
!==
$value
)
{
$this
->
_data
=
$value
;
$this
->
_auth
->
saveAssignment
(
$this
);
}
}
/**
* Saves the changes to an authorization assignment.
*/
public
function
save
()
{
$this
->
_auth
->
saveAssignment
(
$this
);
}
}
yii/rbac/Item.php
View file @
ec949395
...
...
@@ -39,6 +39,7 @@ class Item extends Object
private
$_auth
;
private
$_type
;
private
$_name
;
private
$_oldName
;
private
$_description
;
private
$_bizRule
;
private
$_data
;
...
...
@@ -116,9 +117,8 @@ class Item extends Object
public
function
setName
(
$value
)
{
if
(
$this
->
_name
!==
$value
)
{
$oldName
=
$this
->
_name
;
$
this
->
_
oldName
=
$this
->
_name
;
$this
->
_name
=
$value
;
$this
->
_auth
->
saveItem
(
$this
,
$oldName
);
}
}
...
...
@@ -137,7 +137,6 @@ class Item extends Object
{
if
(
$this
->
_description
!==
$value
)
{
$this
->
_description
=
$value
;
$this
->
_auth
->
saveItem
(
$this
);
}
}
...
...
@@ -156,7 +155,6 @@ class Item extends Object
{
if
(
$this
->
_bizRule
!==
$value
)
{
$this
->
_bizRule
=
$value
;
$this
->
_auth
->
saveItem
(
$this
);
}
}
...
...
@@ -175,7 +173,6 @@ class Item extends Object
{
if
(
$this
->
_data
!==
$value
)
{
$this
->
_data
=
$value
;
$this
->
_auth
->
saveItem
(
$this
);
}
}
...
...
@@ -272,4 +269,13 @@ class Item extends Object
{
return
$this
->
_auth
->
getAssignment
(
$userId
,
$this
->
_name
);
}
/**
* Saves an authorization item to persistent storage.
*/
public
function
save
()
{
$this
->
_auth
->
saveItem
(
$this
,
$this
->
_oldName
);
unset
(
$this
->
_oldName
);
}
}
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