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
220b60f3
Commit
220b60f3
authored
Sep 30, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4275: Added `removeChildren()` to `yii\rbac\ManagerInterface` and implementations
parent
45e472cc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
1 deletion
+33
-1
CHANGELOG.md
framework/CHANGELOG.md
+1
-1
DbManager.php
framework/rbac/DbManager.php
+10
-0
ManagerInterface.php
framework/rbac/ManagerInterface.php
+8
-0
PhpManager.php
framework/rbac/PhpManager.php
+14
-0
No files found.
framework/CHANGELOG.md
View file @
220b60f3
...
@@ -4,7 +4,7 @@ Yii Framework 2 Change Log
...
@@ -4,7 +4,7 @@ Yii Framework 2 Change Log
2.
0.0 under development
2.
0.0 under development
-----------------------
-----------------------
-
no changes in this release.
-
Enh #4275: Added
`removeChildren()`
to
`yii\rbac\ManagerInterface`
and implementations (samdark)
2.0.0-rc September 27, 2014
2.0.0-rc September 27, 2014
...
...
framework/rbac/DbManager.php
View file @
220b60f3
...
@@ -542,6 +542,16 @@ class DbManager extends BaseManager
...
@@ -542,6 +542,16 @@ class DbManager extends BaseManager
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
public
function
removeChildren
(
$parent
)
{
return
$this
->
db
->
createCommand
()
->
delete
(
$this
->
itemChildTable
,
[
'parent'
=>
$parent
->
name
])
->
execute
()
>
0
;
}
/**
* @inheritdoc
*/
public
function
hasChild
(
$parent
,
$child
)
public
function
hasChild
(
$parent
,
$child
)
{
{
return
(
new
Query
)
return
(
new
Query
)
...
...
framework/rbac/ManagerInterface.php
View file @
220b60f3
...
@@ -146,6 +146,14 @@ interface ManagerInterface
...
@@ -146,6 +146,14 @@ interface ManagerInterface
public
function
removeChild
(
$parent
,
$child
);
public
function
removeChild
(
$parent
,
$child
);
/**
/**
* Removed all children form their parent.
* Note, the children items are not deleted. Only the parent-child relationships are removed.
* @param Item $parent
* @return boolean whether the removal is successful
*/
public
function
removeChildren
(
$parent
);
/**
* Returns a value indicating whether the child already exists for the parent.
* Returns a value indicating whether the child already exists for the parent.
* @param Item $parent
* @param Item $parent
* @param Item $child
* @param Item $child
...
...
framework/rbac/PhpManager.php
View file @
220b60f3
...
@@ -218,6 +218,20 @@ class PhpManager extends BaseManager
...
@@ -218,6 +218,20 @@ class PhpManager extends BaseManager
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
public
function
removeChildren
(
$parent
)
{
if
(
isset
(
$this
->
children
[
$parent
->
name
]))
{
unset
(
$this
->
children
[
$parent
->
name
]);
$this
->
saveItems
();
return
true
;
}
else
{
return
false
;
}
}
/**
* @inheritdoc
*/
public
function
hasChild
(
$parent
,
$child
)
public
function
hasChild
(
$parent
,
$child
)
{
{
return
isset
(
$this
->
children
[
$parent
->
name
][
$child
->
name
]);
return
isset
(
$this
->
children
[
$parent
->
name
][
$child
->
name
]);
...
...
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