MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

tUser

MMO\oauth\classes · 1 symbole · générée le 27 Oct 2026

trait

tUser

tUser.php:17

Model for user

#[MMO\core\attributes\ArrayProperty('password', getter: false, setter: 'loadPassword', schema: ['type' => 'string', 'description' => 'the new password'])] trait MMO\oauth\classes\tUser use MMO\oauth\classes\tClient
Espace de noms
MMO\oauth\classes
Utilise les 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.
loadPassword($pwd)The password of the entity's data (an api's PUT, a form saved): a field left blank, or null, keeps the password -- a form sends its empty field with the rest.
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)

Propriétés7

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

Méthodes38

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
retournevoid

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
retournevoid

getClientFlagsText($separator)

tClient.php:64

Get the flags as text

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

getClientRedirectUri()

tUser.php:129

Returns the registered redirect URI (as a string).

function getClientRedirectUri(): string
retournestring

getOwnScopes()

tWithScopes.php:40

Return an array of scopes associated with the token.

function getOwnScopes(): array
retournearraybool>

getScopes()

tWithRoles.php:79

Return an array of scopes associated with the token.

function getScopes(): array
retournearrayiScope>

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
retournebool

isConfidential()

tUser.php:139

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.
retournebool

loadPassword($pwd)

tUser.php:71

The password of the entity's data (an api's PUT, a form saved): a field left blank, or null, keeps the password -- a form sends its empty field with the rest. Set in code, setPassword.

function loadPassword(?string $pwd): bool
$pwdnull | string
retournebool
$user->loadArray(['firstname' => 'Ada', 'password' => '']); // the password is unchanged

scopesText($separator, $true, $false)

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

setPassword($pwd, $verify)

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

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
retournevoid

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://mmoframework.fr/fr/documentation/mmo.oauth/php/ClientRepository.md#clientrepository-isusernameavailable)
$valuestring
retournebool

updateClientFlag($flag, $value)

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