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
b9ea7e6f
Commit
b9ea7e6f
authored
May 10, 2013
by
Alexander Kochetov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DbManager code style fix + right Exception type fix
parent
4b8bcd43
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
DbManager.php
yii/rbac/DbManager.php
+8
-8
No files found.
yii/rbac/DbManager.php
View file @
b9ea7e6f
...
@@ -10,9 +10,11 @@ namespace yii\rbac;
...
@@ -10,9 +10,11 @@ namespace yii\rbac;
use
Yii
;
use
Yii
;
use
yii\db\Connection
;
use
yii\db\Connection
;
use
yii\db\Query
;
use
yii\db\Query
;
use
yii\db\Expression
;
use
yii\base\Exception
;
use
yii\base\Exception
;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidCallException
;
use
yii\base\InvalidCallException
;
use
yii\base\InvalidParamException
;
/**
/**
* DbManager represents an authorization manager that stores authorization information in database.
* DbManager represents an authorization manager that stores authorization information in database.
...
@@ -222,8 +224,7 @@ class DbManager extends Manager
...
@@ -222,8 +224,7 @@ class DbManager extends Manager
$this
->
itemTable
,
$this
->
itemTable
,
$this
->
itemChildTable
$this
->
itemChildTable
))
))
->
where
(
array
(
'parent'
=>
$names
))
->
where
(
array
(
'parent'
=>
$names
,
'name'
=>
new
Expression
(
'child'
)))
->
andWhere
(
'name=child'
)
->
createCommand
(
$this
->
db
)
->
createCommand
(
$this
->
db
)
->
queryAll
();
->
queryAll
();
$children
=
array
();
$children
=
array
();
...
@@ -244,12 +245,12 @@ class DbManager extends Manager
...
@@ -244,12 +245,12 @@ class DbManager extends Manager
* for this particular authorization item.
* for this particular authorization item.
* @param mixed $data additional data associated with this assignment
* @param mixed $data additional data associated with this assignment
* @return Assignment the authorization assignment information.
* @return Assignment the authorization assignment information.
* @throws Exception if the item does not exist or if the item has already been assigned to the user
* @throws
InvalidParam
Exception if the item does not exist or if the item has already been assigned to the user
*/
*/
public
function
assign
(
$userId
,
$itemName
,
$bizRule
=
null
,
$data
=
null
)
public
function
assign
(
$userId
,
$itemName
,
$bizRule
=
null
,
$data
=
null
)
{
{
if
(
$this
->
usingSqlite
()
&&
$this
->
getItem
(
$itemName
)
===
null
)
{
if
(
$this
->
usingSqlite
()
&&
$this
->
getItem
(
$itemName
)
===
null
)
{
throw
new
Exception
(
"The item '
$itemName
' does not exist."
);
throw
new
InvalidParam
Exception
(
"The item '
$itemName
' does not exist."
);
}
}
$this
->
db
->
createCommand
()
$this
->
db
->
createCommand
()
->
insert
(
$this
->
assignmentTable
,
array
(
->
insert
(
$this
->
assignmentTable
,
array
(
...
@@ -385,8 +386,7 @@ class DbManager extends Manager
...
@@ -385,8 +386,7 @@ class DbManager extends Manager
$this
->
itemTable
.
' t1'
,
$this
->
itemTable
.
' t1'
,
$this
->
assignmentTable
.
' t2'
$this
->
assignmentTable
.
' t2'
))
))
->
where
(
array
(
'userid'
=>
$userId
))
->
where
(
array
(
'userid'
=>
$userId
,
'name'
=>
new
Expression
(
'itemname'
)))
->
andWhere
(
'name=itemname'
)
->
createCommand
(
$this
->
db
);
->
createCommand
(
$this
->
db
);
}
else
{
}
else
{
$command
=
$query
->
select
(
'name'
,
'type'
,
'description'
,
't1.bizrule'
,
't1.data'
)
$command
=
$query
->
select
(
'name'
,
'type'
,
'description'
,
't1.bizrule'
,
't1.data'
)
...
@@ -396,9 +396,9 @@ class DbManager extends Manager
...
@@ -396,9 +396,9 @@ class DbManager extends Manager
))
))
->
where
(
array
(
->
where
(
array
(
'userid'
=>
$userId
,
'userid'
=>
$userId
,
'type'
=>
$type
'type'
=>
$type
,
'name'
=>
new
Expression
(
'itemname'
),
))
))
->
andWhere
(
'name=itemname'
)
->
createCommand
(
$this
->
db
);
->
createCommand
(
$this
->
db
);
}
}
$items
=
array
();
$items
=
array
();
...
...
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