Index

tWithRoles

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

trait

tWithRoles

tWithRoles.php:8
trait MMO\oauth\classes\tWithRoles use MMO\oauth\classes\tWithScopes
Namespace
MMO\oauth\classes
Uses traits
tWithScopes

Index

rolesRoles associated with the token.
scopes
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)
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.
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).
markChanged($keys) abstractRecord that properties changed (scopes), so they are saved: aEntity::markChanged
removeRole($role)
scopesText($separator, $true, $false)
setRoles($roles)
setScope($uid, $value)Set the scope's value
setScopes($scopes)

Properties2

roles

Roles associated with the token.

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

scopes

#[MMO\core\attributes\ArrayProperty(setter: 'setScopes', schema: '{...: bool}')] protected array $scopes = []
Type
array

Methods23

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

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

scopesText($separator, $true, $false)

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

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