Index

tUser

MMO\oauth\classes · 1 symbol · generated 5 Oct 2026

trait

tUser

tUser.php:17

Model for user

#[MMO\core\attributes\ArrayProperty('password', getter: false, setter: 'setPassword', schema: ['type' => 'string', 'description' => 'the new password'])] trait MMO\oauth\classes\tUser use MMO\oauth\classes\tClient
Namespace
MMO\oauth\classes
Uses traits
tClient

Index

clientFlagsClient flags
config
lastPasswordChangeLast date the password was changed.
passhashPassword hash: stored, never exported (an API response, a user embedded in another entity's)
rolesRoles associated with the token.
scopes
username
addRole($role)
allow($uids)Add scope if it is not already disallowed
applyScopes($scopes, $set)Apply this scopes onto a list of scopes
blameOwnScope($uid)
blameScope($uid)
clearRoles()
clearScopes()
disallow($uids)
getClientFlagsText($separator)Get the flags as text
getClientRedirectUri()Returns the registered redirect URI (as a string).
getClientSecret()
getConfig()
getLastPasswordChange()
getOwnScope($uid)
getOwnScopes()Return an array of scopes associated with the token.
getRoles()
getScope($uid)
getScopes()Return an array of scopes associated with the token.
getUniqueName()
getUsername()
hasClientFlag($flag)
hasRole($role)
hasScope($uid)
isAllowed($uids)Test if all scopes are allowed
isAnyAllowed($uids)Test if any scope is allowed Scopes expressed as string can be a list of scope's uid seperated by a space (in this case, all scopes MUST be allowed).
isConfidential()Returns true if the client is confidential.
markChanged($keys) abstractRecord that properties changed (scopes), so they are saved: aEntity::markChanged
removeRole($role)
scopesText($separator, $true, $false)
setLastPasswordChange($datetime)
setPassword($pwd, $verify)
setRoles($roles)
setScope($uid, $value)Set the scope's value
setScopes($scopes)
setUsername($value)The property is declared readonly.
updateClientFlag($flag, $value)
verifySecret($pwd)

Properties7

clientFlags

Client flags

#[MMO\core\attributes\ArrayProperty()] protected int $clientFlags = 0
Type
int

config

#[MMO\core\attributes\ArrayProperty()] protected array $config = []
Type
array

lastPasswordChange

Last date the password was changed.

#[MMO\core\attributes\ArrayProperty(setter: false, store: true)] protected ?DateTime $lastPasswordChange = null
Type
null | DateTime

passhash

Password hash: stored, never exported (an API response, a user embedded in another entity's)

#[MMO\core\attributes\ArrayProperty(setter: false, store: true)] protected string $passhash
Type
string

roles

Roles associated with the token.

#[MMO\core\attributes\ArrayProperty(schema: '[MMO\\oauth\\entities\\Role]')] protected array $roles = []
Type
array

scopes

#[MMO\core\attributes\Serialize(serialize: 'getOwnScopes')] #[MMO\core\attributes\ArrayProperty(schema: '{...: bool}')] protected array $scopes = []
Type
array

username

#[MMO\core\attributes\ArrayProperty(setter: false, store: true)] protected string $username = ''
Type
string

Methods37

allow($uids)

tWithScopes.php:100

Add scope if it is not already disallowed

function allow(object|string ...$uids): void
...$uidsobject | stringlist of scope's uid separated by space or a list of uid
returnsvoid

applyScopes($scopes, $set)

tWithScopes.php:136

Apply this scopes onto a list of scopes

function applyScopes(array &$scopes, bool $set = false): void
$scopesarraylist of {scope:uid} => {allow:bool}
$set = falseboolmergeScopes
returnsvoid

getClientFlagsText($separator)

tClient.php:64

Get the flags as text

function getClientFlagsText(?string $separator = ','): array|string
$separator = ','null | stringif null, will return an array
returnsarray | string

getClientRedirectUri()

tUser.php:115

Returns the registered redirect URI (as a string).

function getClientRedirectUri(): string
returnsstring

getOwnScopes()

tWithScopes.php:40

Return an array of scopes associated with the token.

function getOwnScopes(): array
returnsarraybool>

getScopes()

tWithRoles.php:79

Return an array of scopes associated with the token.

function getScopes(): array
returnsarrayiScope>

isAnyAllowed($uids)

tWithScopes.php:125

Test if any scope is allowed Scopes expressed as string can be a list of scope's uid seperated by a space (in this case, all scopes MUST be allowed).

function isAnyAllowed(object|string ...$uids): bool
...$uidsobject | string
returnsbool

isConfidential()

tUser.php:125

Returns true if the client is confidential.

function isConfidential(): boolConfidential client are generally web application that use rest to get the credentials. User-agent (browser) or native application are usually public clients.
returnsbool

scopesText($separator, $true, $false)

tWithScopes.php:44
function scopesText(string $separator = ' | ', string $true = '✓', string $false = '✗'): string
$separator = ' | 'string
$true = '✓'string
$false = '✗'string
returnsstring

setPassword($pwd, $verify)

tUser.php:68
function setPassword(string $pwd, bool $verify = true): bool
$pwdstring
$verify = truebool
returnsbool

setScope($uid, $value)

tWithScopes.php:65

Set the scope's value

function setScope(object|string $uid, ?bool $value): void
$uidobject | string
$valuenull | boolif null, remove the scope from the list of scopes
returnsvoid

setUsername($value)

tUser.php:59

The property is declared readonly. $entity['username'] = 'xxx' will not work.

function setUsername(string $value): boolBut calling directly this function will set the username. WARNING: you MUST verify that the username is unique before calling this function. [`ClientRepository::isUsernameAvailable`](https://mcp.mmoframework.fr/documentation/mmo.oauth/php/ClientRepository.md#clientrepository-isusernameavailable)
$valuestring
returnsbool

updateClientFlag($flag, $value)

tClient.php:47
function updateClientFlag(int $flag, bool $value = true): bool
$flagint
$value = truebool
returnsbool