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
2fc8cb45
Commit
2fc8cb45
authored
Jul 29, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4489: Fixed MySQL RBAC manager
parent
c6569b1a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
DbManager.php
framework/rbac/DbManager.php
+6
-6
No files found.
framework/rbac/DbManager.php
View file @
2fc8cb45
...
@@ -345,7 +345,7 @@ class DbManager extends BaseManager
...
@@ -345,7 +345,7 @@ class DbManager extends BaseManager
$query
=
(
new
Query
)
->
select
(
'b.*'
)
$query
=
(
new
Query
)
->
select
(
'b.*'
)
->
from
([
'a'
=>
$this
->
assignmentTable
,
'b'
=>
$this
->
itemTable
])
->
from
([
'a'
=>
$this
->
assignmentTable
,
'b'
=>
$this
->
itemTable
])
->
where
(
'a.item_name=b.name'
)
->
where
(
'a.item_name=b.name'
)
->
andWhere
([
'a.user_id'
=>
$userId
]);
->
andWhere
([
'a.user_id'
=>
(
string
)
$userId
]);
$roles
=
[];
$roles
=
[];
foreach
(
$query
->
all
(
$this
->
db
)
as
$row
)
{
foreach
(
$query
->
all
(
$this
->
db
)
as
$row
)
{
...
@@ -383,7 +383,7 @@ class DbManager extends BaseManager
...
@@ -383,7 +383,7 @@ class DbManager extends BaseManager
{
{
$query
=
(
new
Query
)
->
select
(
'item_name'
)
$query
=
(
new
Query
)
->
select
(
'item_name'
)
->
from
(
$this
->
assignmentTable
)
->
from
(
$this
->
assignmentTable
)
->
where
([
'user_id'
=>
$userId
]);
->
where
([
'user_id'
=>
(
string
)
$userId
]);
$childrenList
=
$this
->
getChildrenList
();
$childrenList
=
$this
->
getChildrenList
();
$result
=
[];
$result
=
[];
...
@@ -470,7 +470,7 @@ class DbManager extends BaseManager
...
@@ -470,7 +470,7 @@ class DbManager extends BaseManager
public
function
getAssignment
(
$roleName
,
$userId
)
public
function
getAssignment
(
$roleName
,
$userId
)
{
{
$row
=
(
new
Query
)
->
from
(
$this
->
assignmentTable
)
$row
=
(
new
Query
)
->
from
(
$this
->
assignmentTable
)
->
where
([
'user_id'
=>
$userId
,
'item_name'
=>
$roleName
])
->
where
([
'user_id'
=>
(
string
)
$userId
,
'item_name'
=>
$roleName
])
->
one
(
$this
->
db
);
->
one
(
$this
->
db
);
if
(
$row
===
false
)
{
if
(
$row
===
false
)
{
...
@@ -491,7 +491,7 @@ class DbManager extends BaseManager
...
@@ -491,7 +491,7 @@ class DbManager extends BaseManager
{
{
$query
=
(
new
Query
)
$query
=
(
new
Query
)
->
from
(
$this
->
assignmentTable
)
->
from
(
$this
->
assignmentTable
)
->
where
([
'user_id'
=>
$userId
]);
->
where
([
'user_id'
=>
(
string
)
$userId
]);
$assignments
=
[];
$assignments
=
[];
foreach
(
$query
->
all
(
$this
->
db
)
as
$row
)
{
foreach
(
$query
->
all
(
$this
->
db
)
as
$row
)
{
...
@@ -614,7 +614,7 @@ class DbManager extends BaseManager
...
@@ -614,7 +614,7 @@ class DbManager extends BaseManager
public
function
revoke
(
$role
,
$userId
)
public
function
revoke
(
$role
,
$userId
)
{
{
return
$this
->
db
->
createCommand
()
return
$this
->
db
->
createCommand
()
->
delete
(
$this
->
assignmentTable
,
[
'user_id'
=>
$userId
,
'item_name'
=>
$role
->
name
])
->
delete
(
$this
->
assignmentTable
,
[
'user_id'
=>
(
string
)
$userId
,
'item_name'
=>
$role
->
name
])
->
execute
()
>
0
;
->
execute
()
>
0
;
}
}
...
@@ -624,7 +624,7 @@ class DbManager extends BaseManager
...
@@ -624,7 +624,7 @@ class DbManager extends BaseManager
public
function
revokeAll
(
$userId
)
public
function
revokeAll
(
$userId
)
{
{
return
$this
->
db
->
createCommand
()
return
$this
->
db
->
createCommand
()
->
delete
(
$this
->
assignmentTable
,
[
'user_id'
=>
$userId
])
->
delete
(
$this
->
assignmentTable
,
[
'user_id'
=>
(
string
)
$userId
])
->
execute
()
>
0
;
->
execute
()
>
0
;
}
}
...
...
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