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
f61734d4
Commit
f61734d4
authored
Mar 16, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added $checkSession parameter to User::getIsGuest() and getId().
parent
7960ccdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
User.php
framework/web/User.php
+10
-4
No files found.
framework/web/User.php
View file @
f61734d4
...
@@ -285,20 +285,26 @@ class User extends Component
...
@@ -285,20 +285,26 @@ class User extends Component
/**
/**
* Returns a value indicating whether the user is a guest (not authenticated).
* Returns a value indicating whether the user is a guest (not authenticated).
* @param boolean $checkSession whether to check the session to determine if the user is a guest.
* Note that if this is false, it is possible that the user may not be a guest while this method still returns
* true. This is because the session is not checked.
* @return boolean whether the current user is a guest.
* @return boolean whether the current user is a guest.
*/
*/
public
function
getIsGuest
()
public
function
getIsGuest
(
$checkSession
=
true
)
{
{
return
$this
->
getIdentity
()
===
null
;
return
$this
->
getIdentity
(
$checkSession
)
===
null
;
}
}
/**
/**
* Returns a value that uniquely represents the user.
* Returns a value that uniquely represents the user.
* @param boolean $checkSession whether to check the session to determine the user ID.
* Note that if this is false, it is possible that this method returns null although the user may not
* be a guest. This is because the session is not checked.
* @return string|integer the unique identifier for the user. If null, it means the user is a guest.
* @return string|integer the unique identifier for the user. If null, it means the user is a guest.
*/
*/
public
function
getId
()
public
function
getId
(
$checkSession
=
true
)
{
{
$identity
=
$this
->
getIdentity
();
$identity
=
$this
->
getIdentity
(
$checkSession
);
return
$identity
!==
null
?
$identity
->
getId
()
:
null
;
return
$identity
!==
null
?
$identity
->
getId
()
:
null
;
}
}
...
...
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