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
9841d6c6
Commit
9841d6c6
authored
May 05, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes issue #124.
parent
e087533f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletion
+27
-1
Application.php
framework/base/Application.php
+9
-0
AccessRule.php
framework/web/AccessRule.php
+1
-1
User.php
framework/web/User.php
+17
-0
No files found.
framework/base/Application.php
View file @
9841d6c6
...
...
@@ -306,6 +306,15 @@ class Application extends Module
}
/**
* @return null|Component
* @todo
*/
public
function
getAuthManager
()
{
return
$this
->
getComponent
(
'auth'
);
}
/**
* Registers the core application components.
* @see setComponents
*/
...
...
framework/web/AccessRule.php
View file @
9841d6c6
...
...
@@ -144,7 +144,7 @@ class AccessRule extends Component
return
true
;
}
elseif
(
$role
===
'@'
&&
!
$user
->
getIsGuest
())
{
return
true
;
}
elseif
(
$user
->
has
Access
(
$role
))
{
}
elseif
(
$user
->
check
Access
(
$role
))
{
return
true
;
}
}
...
...
framework/web/User.php
View file @
9841d6c6
...
...
@@ -447,4 +447,21 @@ class User extends Component
}
}
}
/**
* Checks whether the user has access to the specified operation.
* @param $operator
* @param array $params
* @return bool
* @todo
*/
public
function
checkAccess
(
$operation
,
$params
=
array
())
{
$auth
=
Yii
::
$app
->
getAuthManager
();
if
(
$auth
!==
null
)
{
return
$auth
->
checkAccess
(
$this
->
getId
(),
$operation
,
$params
);
}
else
{
return
true
;
}
}
}
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