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

ScopesList

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

class

ScopesList

ScopesList.php:25

Event to request the list of existing scopes: what the roles' editor offers (AccessController::routeScopesCatalog).

class MMO\oauth\events\ScopesList extends MMO\core\events\SingleSignal
Espace de noms
MMO\oauth\events
Étend
SingleSignal
Besides the scopes themselves, a listener says: - the actions checked under a scope ([`addAction`](https://mmoframework.fr/fr/documentation/mmo.oauth/php/events/ScopesList.md#scopeslist-addaction)): `data.main.orders#edit` only means something because the data api checks `#edit` under `data`. A listed scope holding a `#` declares its action too (`dev.boards#write`); - the scopes whose children are ids, not listed one by one ([`openScope`](https://mmoframework.fr/fr/documentation/mmo.oauth/php/events/ScopesList.md#scopeslist-openscope)): `data.main.orders.{id}`; - the scopes a page needs besides its own ([`addNeeds`](https://mmoframework.fr/fr/documentation/mmo.oauth/php/events/ScopesList.md#scopeslist-addneeds)): `pages.settings` needs `admin`.
ScopesList::AddListener(function (ScopesList $request) { $request->addScope('shop', 'Access to the shop'); $request->addAction('shop', 'refund', 'Refund an order'); // shop.orders#refund is checked by the shop });

Index

actions
needs
open
addAction($scope, $action, $text)Declare an action checked under $scope and every scope below it: a rule {scope}#{action} means something
addNeeds($scope, $scopes)Say that $scope also needs $scopes: a page whose folder asks "scopes": "admin"
addScope($id, $text)
addScopes($scopes)
getActions()
getNeeds()
getOpenScopes()
getScopes()
getUser()
hasScope($id)
openScope($scope)Declare that $scope's children are ids (data.main.orders.{id}): a rule on one of them is not unknown
__construct()

Propriétés3

actions

protected array $actions = []
Type
array

needs

protected array $needs = []
Type
array

open

protected array $open = []
Type
array

Méthodes12

addAction($scope, $action, $text)

ScopesList.php:67

Declare an action checked under $scope and every scope below it: a rule {scope}#{action} means something

function addAction(string $scope, string $action, string $text): void
$scopestringdata, edms.files
$actionstringwithout its #
$textstringwhat it allows, translated
retournevoid
$request->addAction('data', 'edit', I18n::_('Change an entity'));

addNeeds($scope, $scopes)

ScopesList.php:103

Say that $scope also needs $scopes: a page whose folder asks "scopes": "admin"

function addNeeds(string $scope, string $scopes): void
$scopestring
$scopesstringspace-separated, all needed
retournevoid
$request->addNeeds('pages.settings', 'admin');

getActions()

ScopesList.php:75
function getActions(): array
retournearrayarray<string, string>> scope => action => text: those added and those of the scopes listed with a # (dev.boards#write)

getNeeds()

ScopesList.php:109
function getNeeds(): array
retournearraystring> scope => the scopes, space-separated, it also needs

openScope($scope)

ScopesList.php:89

Declare that $scope's children are ids (data.main.orders.{id}): a rule on one of them is not unknown

function openScope(string $scope): void
$scopestring
retournevoid
$request->openScope('data.main.orders');
Membres hérités (21)
PropriétésDéclaré parDescription
ListenersEvent
originEvent
returnValueSignal
MéthodesDéclaré parDescription
AddListener($handler, $order)EventRegister a listener directly (as opposed to ConnectListeners's attribute-based discovery).
ConnectListeners($obj)EventScan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class.
DisconnectListeners($obj)EventUndo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class.
dispatch()EventInvoke every GetListeners listener with $this.
GetListeners()EventCollect every listener for this class, including those registered on its parent classes (so a subclass event is also caught by listeners of its parent event), sorted by ascending $order (ties keep …
getOrigin()Event
getReturn()Signal
HasListener($handler)Event
hasReturn()Signal
Instantiate($config)SingleSignal(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
IsShared()SingleSignal
RemoveListener($handler)EventRemove the last added handler from the listeners.
Send($args)SingleSignalSend this signal, but only the FIRST time it's ever called: subsequent calls (with any, even different, $args) just return the same already-dispatched instance, unchanged.
SetListenerOrder($handler, $order)EventChange the order of an already-registered listener, whether added directly via AddListener or indirectly via ConnectListeners (which also stores its [$obj, $methodName] callables here).
setReturn($value, $stop)Signal
Shared()SingleSignalGet the shared instance, creating (and configuring) it on first call.
Unshare($serialize)SingleSignalRemove the shared instance, so the next Shared() call creates a fresh one.
Value($args)SingleSignal