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
9ccf7ae3
Commit
9ccf7ae3
authored
May 10, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #212 from creocoder/db-auth-manager-enh
Suggest \yii\rbac\DbManager some Db fields renaming
parents
9d663bed
9d3a3b3e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
DbManager.php
yii/rbac/DbManager.php
+20
-20
No files found.
yii/rbac/DbManager.php
View file @
9ccf7ae3
...
...
@@ -254,8 +254,8 @@ class DbManager extends Manager
}
$this
->
db
->
createCommand
()
->
insert
(
$this
->
assignmentTable
,
array
(
'userid'
=>
$userId
,
'itemname'
=>
$itemName
,
'user
_
id'
=>
$userId
,
'item
_
name'
=>
$itemName
,
'bizrule'
=>
$bizRule
,
'data'
=>
serialize
(
$data
)
));
...
...
@@ -272,8 +272,8 @@ class DbManager extends Manager
{
return
$this
->
db
->
createCommand
()
->
delete
(
$this
->
assignmentTable
,
array
(
'userid'
=>
$userId
,
'itemname'
=>
$itemName
'user
_
id'
=>
$userId
,
'item
_
name'
=>
$itemName
))
>
0
;
}
...
...
@@ -286,11 +286,11 @@ class DbManager extends Manager
public
function
isAssigned
(
$itemName
,
$userId
)
{
$query
=
new
Query
;
return
$query
->
select
(
array
(
'itemname'
))
return
$query
->
select
(
array
(
'item
_
name'
))
->
from
(
$this
->
assignmentTable
)
->
where
(
array
(
'userid'
=>
$userId
,
'itemname'
=>
$itemName
'user
_
id'
=>
$userId
,
'item
_
name'
=>
$itemName
))
->
createCommand
(
$this
->
db
)
->
queryScalar
()
!==
false
;
...
...
@@ -308,8 +308,8 @@ class DbManager extends Manager
$query
=
new
Query
;
$row
=
$query
->
from
(
$this
->
assignmentTable
)
->
where
(
array
(
'userid'
=>
$userId
,
'itemname'
=>
$itemName
'user
_
id'
=>
$userId
,
'item
_
name'
=>
$itemName
))
->
createCommand
(
$this
->
db
)
->
queryRow
();
...
...
@@ -317,7 +317,7 @@ class DbManager extends Manager
if
((
$data
=
@
unserialize
(
$row
[
'data'
]))
===
false
)
{
$data
=
null
;
}
return
new
Assignment
(
$this
,
$row
[
'user
id'
],
$row
[
'item
name'
],
$row
[
'bizrule'
],
$data
);
return
new
Assignment
(
$this
,
$row
[
'user
_id'
],
$row
[
'item_
name'
],
$row
[
'bizrule'
],
$data
);
}
else
{
return
null
;
}
...
...
@@ -333,7 +333,7 @@ class DbManager extends Manager
{
$query
=
new
Query
;
$rows
=
$query
->
from
(
$this
->
assignmentTable
)
->
where
(
array
(
'userid'
=>
$userId
))
->
where
(
array
(
'user
_
id'
=>
$userId
))
->
createCommand
(
$this
->
db
)
->
queryAll
();
$assignments
=
array
();
...
...
@@ -341,7 +341,7 @@ class DbManager extends Manager
if
((
$data
=
@
unserialize
(
$row
[
'data'
]))
===
false
)
{
$data
=
null
;
}
$assignments
[
$row
[
'item
name'
]]
=
new
Assignment
(
$this
,
$row
[
'userid'
],
$row
[
'item
name'
],
$row
[
'bizrule'
],
$data
);
$assignments
[
$row
[
'item
_name'
]]
=
new
Assignment
(
$this
,
$row
[
'user_id'
],
$row
[
'item_
name'
],
$row
[
'bizrule'
],
$data
);
}
return
$assignments
;
}
...
...
@@ -357,8 +357,8 @@ class DbManager extends Manager
'bizrule'
=>
$assignment
->
getBizRule
(),
'data'
=>
serialize
(
$assignment
->
getData
()),
),
array
(
'userid'
=>
$assignment
->
getUserId
(),
'itemname'
=>
$assignment
->
getItemName
()
'user
_
id'
=>
$assignment
->
getUserId
(),
'item
_
name'
=>
$assignment
->
getItemName
()
));
}
...
...
@@ -386,7 +386,7 @@ class DbManager extends Manager
$this
->
itemTable
.
' t1'
,
$this
->
assignmentTable
.
' t2'
))
->
where
(
array
(
'user
id'
=>
$userId
,
'name'
=>
new
Expression
(
'item
name'
)))
->
where
(
array
(
'user
_id'
=>
$userId
,
'name'
=>
new
Expression
(
'item_
name'
)))
->
createCommand
(
$this
->
db
);
}
else
{
$command
=
$query
->
select
(
'name'
,
'type'
,
'description'
,
't1.bizrule'
,
't1.data'
)
...
...
@@ -395,9 +395,9 @@ class DbManager extends Manager
$this
->
assignmentTable
.
' t2'
))
->
where
(
array
(
'userid'
=>
$userId
,
'user
_
id'
=>
$userId
,
'type'
=>
$type
,
'name'
=>
new
Expression
(
'itemname'
),
'name'
=>
new
Expression
(
'item
_
name'
),
))
->
createCommand
(
$this
->
db
);
}
...
...
@@ -452,7 +452,7 @@ class DbManager extends Manager
':name1'
=>
$name
,
':name2'
=>
$name
));
$this
->
db
->
createCommand
()
->
delete
(
$this
->
assignmentTable
,
array
(
'itemname'
=>
$name
));
$this
->
db
->
createCommand
()
->
delete
(
$this
->
assignmentTable
,
array
(
'item
_
name'
=>
$name
));
}
return
$this
->
db
->
createCommand
()
->
delete
(
$this
->
itemTable
,
array
(
'name'
=>
$name
))
>
0
;
}
...
...
@@ -501,9 +501,9 @@ class DbManager extends Manager
));
$this
->
db
->
createCommand
()
->
update
(
$this
->
assignmentTable
,
array
(
'itemname'
=>
$item
->
getName
(),
'item
_
name'
=>
$item
->
getName
(),
),
array
(
'itemname'
=>
$oldName
,
'item
_
name'
=>
$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