Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7425086
UserEntity.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1004 B
Referenced Files
None
Subscribers
None
UserEntity.php
View Options
<?php
namespace
MediaWiki\Extension\OAuth\Entity
;
use
League\OAuth2\Server\Entities\UserEntityInterface
;
use
MediaWiki\Exception\MWException
;
use
MediaWiki\Extension\OAuth\Backend\Utils
;
use
MediaWiki\User\User
;
class
UserEntity
implements
UserEntityInterface
{
/**
* @var int
*/
private
$identifier
;
/**
* @param User $user
* @return UserEntity|null
*/
public
static
function
newFromMWUser
(
User
$user
)
{
try
{
$userId
=
Utils
::
getCentralIdFromLocalUser
(
$user
);
if
(
!
$userId
)
{
return
null
;
}
return
new
static
(
$userId
);
}
catch
(
MWException
)
{
return
null
;
}
}
/**
* @param int $identifier
*/
public
function
__construct
(
$identifier
)
{
$this
->
identifier
=
$identifier
;
}
/**
* Return the user's identifier.
*
* @return int
*/
public
function
getIdentifier
()
{
return
$this
->
identifier
;
}
/**
* @return User|false
*/
public
function
getMWUser
()
{
return
Utils
::
getLocalUserFromCentralId
(
$this
->
identifier
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 07:44 (19 h, 49 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f1/d5/faaccbde16efa851a785c3c8ca87
Default Alt Text
UserEntity.php (1004 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment