AccessController
MMO\oauth\controllers · 1 symbol · generated 27 Oct 2026
AccessController
AccessController.php:37- Namespace
MMO\oauth\controllers- Extends
- aController
- Todo
- implements route to get a token from a client and set the token in the authorization header
Index
| CSRF_KEY | ||
| allowAnonymous | ||
| allowUserCreationWithCode | ||
| anonymousScopes | ||
| clients | ||
| codeAuthentifiers | ||
| dataControllers | ||
| heldScopes | ||
| holder | ||
| loginTpl | ||
| privateCollections | ||
| privateKey | ||
| publicKey | ||
| rightsCollections | ||
| rightsScope | ||
| route | ||
| superScope | ||
| user | ||
| carriesRights($entity) | Tell if $entity carries rights: a role (any change), a client whose scopes or roles changed, a token, an entity of | |
| checkCommitRights($entity) | Check that the client of a data api request can write $entity, if it carries rights or is private (carriesRights, $privateCollections): it held $rightsScope (or it changes its own pr… | |
| checkCommitScopes($entity) | Check that the user can commit $entity's changes: its status, its creation, its changes or its removal | |
| checkPrivatePaths($query) | What a query returns tells the values it filters or sorts on: of the entities of a private collection ($privateCollections), a client without the rights filters and sorts only on what it reads… | |
| collectionValue($values, $collection) | ||
| doLogin($route) | ||
| extractUser($route) | ||
| filterPrivate($query) | Leave out of a data api listing what $privateCollections keep from a client without the rights: a collection none, the tokens of others, and opacify the other clients of a collection self,… | |
| forgotPassword($route) | ||
| getCodeAuthentifier() | ||
| getRedirectUri($route, $default) | ||
| getUser() | ||
| hasUserScope($uid) | Check if user or anonymous user has a given scope | |
| hideRecursiveContent($contents, $required) | Hide recursively the children content base on user scopes: pages.{path}, and the scopes the content and its parents ask besides (Content::$scopes: admin for a folder of administration pages) | |
| holds($scope) | Tell if the client of the request held $scope when the request started: what it changed since (its own role, its own scopes) is left aside | |
| holdsRights() | ||
| isDataApi() | Tell if the current route is one of the generic data api ($dataControllers), which serves any collection by its name and writes whatever properties its client sends | |
| isLeftToItsModule($value) | Tell if the rights on an entity, or on a collection, are its module's to check: everywhere but in the routes of the generic data api ($dataControllers), where the data.* scopes decide, as fo… | |
| isOwn($entity) | ||
| isReadablePath($collection, $path) | ||
| isRequestQuery($query) | ||
| isUnserved($value) | ||
| isUserAllowed($uids) | Check if user or anonymous user is allowed to do something | |
| listRecursiveContentScope($request, $content, $required) | ||
| login($route) | ||
| loginJSON($route) | ||
| logout($route) | ||
| onCommit($commit) | ||
| onModeAccess($event) | a mode with a scope is offered to whoever holds it (mmo.client's Modes) | |
| onModesPreference($event) | The modes the user saved (config.modes), else the ones their roles give (Role::$modes): the first role saying a level gives it, the layers of every role add up. | |
| onNotificationRecipient($event) | whose notifications the notification centre shows: the user's | |
| onPageContents($pageContents) | Filter content using scopes pages.* | |
| onQuery($query) | ||
| onRoute($route) | ||
| onScopes($request) | ||
| onScopesListModes($request) | a mode's scope is listed with the others, in the roles' editor | |
| opacifyPrivateReferences($entity, $depth) | Opacify the entities of a private collection ($privateCollections) that $entity references, but the client's own: a group listing its users shows their uid and title only. | |
| privacyOf($collection) | ||
| readablePaths($collection) | ||
| refusing() | ||
| renderNoToken($route, $exception) | ||
| resetPassword($route) | ||
| restoreAccount($route) | Leave a session opened by « Changer de compte » (doLogin's switchAccount) for one of the account that opened it, without its password: that account typed it to open this one. | |
| routeCreateUser($route) | ||
| routeGetUserConfig($route) | ||
| routePutUserConfig($route) | ||
| routeScopes($route) | ||
| routeScopesCatalog($route) | What the scopes' editor (<mmo-scopes>) needs to explain and check the rules of a role or a client - scopes: the scopes listed (ScopesList), id => text; - actions: scope => action => text… | |
| scopeNames($uids, $open) | ||
| sendPasswordReset($login) | Mail $login's account a link that logs it in to choose a new password (login?token=...&reset=true). |
Constants1
CSRF_KEY
Properties17
allowAnonymous
- Type
- bool
allowUserCreationWithCode
- Type
- bool
anonymousScopes
- Type
- array
clients
- Type
- ClientRepository
codeAuthentifiers
- Type
- null | Collection
dataControllers
- Type
- array
heldScopes
holder
loginTpl
- Type
- string
privateCollections
- Type
- array
privateKey
- Type
- PrivateKey
publicKey
- Type
- PublicKey
rightsCollections
- Type
- array
rightsScope
- Type
- string
- See
$privateCollectionsin full. An application whose administrators hold another scope names it (admin)
route
superScope
- Type
- string
user
Methods50
carriesRights($entity)
AccessController.php:223Tell if $entity carries rights: a role (any change), a client whose scopes or roles changed, a token, an entity of
checkCommitRights($entity)
AccessController.php:239Check that the client of a data api request can write $entity, if it carries rights or is private (carriesRights, $privateCollections): it held $rightsScope (or it changes its own private entity, but not its rights), and, without $superScope, it neither changes its own rights nor writes rights granting that scope.
checkCommitScopes($entity)
AccessController.php:623Check that the user can commit $entity's changes: its status, its creation, its changes or its removal
| $entity | iEntity | |
| returns | void | |
| throws | (403) if it cannot: a right the user has not, not a malformed request |
checkPrivatePaths($query)
AccessController.php:315What a query returns tells the values it filters or sorts on: of the entities of a private collection ($privateCollections), a client without the rights filters and sorts only on what it reads of them, opacified (readablePaths), its own included -- not ?filters[emails/default][$regex]=^a nor a full text search ($text), which found the others' e-mails or scopes out one character at a time (my.oviepro #90). Wherever they are: in the collection queried, or referenced by it (owner/emails/default)
collectionValue($values, $collection)
AccessController.php:203| $values | array | |
| $collection | iCollection | |
| returns | mixed | the value $values gives $collection, or null |
doLogin($route)
AccessController.php:778| $route | Route | |
| returns | AccessToken |
extractUser($route)
AccessController.php:381filterPrivate($query)
AccessController.php:273Leave out of a data api listing what $privateCollections keep from a client without the rights: a collection none, the tokens of others, and opacify the other clients of a collection self, wherever they are referenced
forgotPassword($route)
AccessController.php:717getCodeAuthentifier()
AccessController.php:113| returns | null | CodeAuthentifier |
getRedirectUri($route, $default)
AccessController.php:387getUser()
AccessController.php:108hasUserScope($uid)
AccessController.php:132Check if user or anonymous user has a given scope
hideRecursiveContent($contents, $required)
AccessController.php:496Hide recursively the children content base on user scopes: pages.{path}, and the scopes the content and its parents ask besides (Content::$scopes: admin for a folder of administration pages)
holds($scope)
AccessController.php:182Tell if the client of the request held $scope when the request started: what it changed since (its own role, its own scopes) is left aside
holdsRights()
AccessController.php:187| returns | bool | true if the client of the request writes rights and reads $privateCollections in full |
isDataApi()
AccessController.php:167Tell if the current route is one of the generic data api ($dataControllers), which serves any collection by its name and writes whatever properties its client sends
| returns | bool |
isLeftToItsModule($value)
AccessController.php:148| $value | iEntity | iCollection | |
| returns | bool |
isOwn($entity)
AccessController.php:213isReadablePath($collection, $path)
AccessController.php:333| $collection | iCollection | |
| $path | string | a path a query of $collection filters or sorts on (owner/emails/default, or owner.emails.default) |
| returns | bool | false if it reads, in a collection of $privateCollections, more than readablePaths |
isRequestQuery($query)
AccessController.php:300| $query | Query | |
| returns | bool | true if $query is the one the client asked the data api for (its filters, sort and search): a listing's (RepositoryController::getQuery), any of the statistics'. Not those the request runs on its way (a @unique check of the account it saves), which are the server's |
isUnserved($value)
AccessController.php:155| $value | iEntity | iCollection | |
| returns | bool | true when $value's repository is not one RepositoryController serves (isLeftToItsModule) |
isUserAllowed($uids)
AccessController.php:122Check if user or anonymous user is allowed to do something
listRecursiveContentScope($request, $content, $required)
AccessController.php:644| $request | ScopesList | |
| $content | Content | |
| $required = '' | string | the scopes the parents of $content ask besides their own (hideRecursiveContent) |
| returns | void |
login($route)
AccessController.php:812loginJSON($route)
AccessController.php:806logout($route)
AccessController.php:686onCommit($commit)
AccessController.php:596onModeAccess($event)
AccessController.php:508a mode with a scope is offered to whoever holds it (mmo.client's Modes)
| $event | ModeAccess | |
| returns | void |
onModesPreference($event)
AccessController.php:517The modes the user saved (config.modes), else the ones their roles give (Role::$modes): the first role saying a level gives it, the layers of every role add up.
| $event | ModesPreference | |
| returns | void |
onNotificationRecipient($event)
AccessController.php:537whose notifications the notification centre shows: the user's
| $event | NotificationRecipient | |
| returns | void |
onPageContents($pageContents)
AccessController.php:558Filter content using scopes pages.*
| $pageContents | PageContents | |
| returns | void |
onQuery($query)
AccessController.php:565onRoute($route)
AccessController.php:399onScopes($request)
AccessController.php:655| $request | ScopesList | |
| returns | void |
onScopesListModes($request)
AccessController.php:543a mode's scope is listed with the others, in the roles' editor
| $request | ScopesList | |
| returns | void |
opacifyPrivateReferences($entity, $depth)
AccessController.php:361Opacify the entities of a private collection ($privateCollections) that $entity references, but the client's own: a group listing its users shows their uid and title only. Embedded entities are looked into
privacyOf($collection)
AccessController.php:192| $collection | iCollection | |
| returns | null | string | how $privateCollections serve $collection to a client without the rights: self, none or null (in full) |
readablePaths($collection)
AccessController.php:352| $collection | iCollection | |
| returns | array | the paths an entity of $collection shows opacified (aEntity::opacify: its uid and title), or itself ('') |
refusing()
AccessController.php:104| returns | Route | what a refusal answers: the request this controller routed, else the application's current one (a command of a script routing AdminController alone), else a request of the command line |
renderNoToken($route, $exception)
AccessController.php:465resetPassword($route)
AccessController.php:759restoreAccount($route)
AccessController.php:696Leave a session opened by « Changer de compte » (doLogin's switchAccount) for one of the account that opened it, without its password: that account typed it to open this one. The session left ends.
routeCreateUser($route)
AccessController.php:901routeGetUserConfig($route)
AccessController.php:934routePutUserConfig($route)
AccessController.php:919| $route | Route | |
| returns |
routeScopes($route)
AccessController.php:946routeScopesCatalog($route)
AccessController.php:993scopeNames($uids, $open)
AccessController.php:1040| $uids | array | rules |
| $open | array | the scopes whose children are ids (data.main.roles) |
| returns | array | string> scope => the title of the entity it names, for those naming one |
sendPasswordReset($login)
AccessController.php:736Mail $login's account a link that logs it in to choose a new password (login?token=...&reset=true).
| $login | string | a username, or an account's email. |
| returns | bool | false when nothing was sent: no active account with an email answers to $login. |
| throws | if its tokens cannot be stored, or the mail cannot be sent (MailController::mail). |
Inherited members (55)
| Constants | Declared by | Description | |
|---|---|---|---|
ALERT | iLogLevel | Alert: Action must be taken immediately. | |
ALL | iLogLevel | Mask for all | |
ALL_PLUS | iLogLevel | debug everything | |
BACKTRACE | iLogLevel | ||
CRITICAL | iLogLevel | Critical: Critical conditions. | |
DEBUG | iLogLevel | Debug: Detailed debug information. | |
DEEP | iLogLevel | debug everything with arguments | |
EMERGENCY | iLogLevel | Emergency: System is unusable. | |
ERROR | iLogLevel | Error: Runtime errors that do not require immediate action but should typically be logged and monitored. | |
ERROR_PLUS | iLogLevel | Mask for all error | |
FATAL | iLogLevel | Mask for all fatal error | |
INFO | iLogLevel | Info: Interesting events. | |
INFO_PLUS | iLogLevel | Mask for all errors/warning/notices/info | |
MEMORY | iLogLevel | include backtrace object | |
NOTICE | iLogLevel | Notice: Normal but significant events. | |
NOTICE_PLUS | iLogLevel | Mask for all errors/warning/notices/info | |
TRACE | iLogLevel | include backtrace as origins | |
WARNING | iLogLevel | Warning: Exceptional occurrences that are not errors. | |
WARNING_PLUS | iLogLevel | Mask for all errors and warnings |
| Properties | Declared by | Description | |
|---|---|---|---|
verbosity | aModule |
| Methods | Declared by | Description | |
|---|---|---|---|
alert($message, $context) | aModule | Action must be taken immediately. | |
backtraces($message, $context) | aModule | Force-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it). | |
Configure($config) | aModule | Merge $config into this module's configuration in the shared Configuration. | |
critical($message, $context) | aModule | Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask. | |
debug($message, $context) | aModule | Detailed debug information. | |
debugName() | aModule | Human-readable identifier used as the default {origin} in this instance's log messages. | |
DefaultConfig() | aModule | The config a module starts from before anything loaded via Configuration is merged in. | |
emergency($message, $context) | aModule | System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask. | |
error($message, $context) | aModule | Runtime errors that do not require immediate action but should typically be logged and monitored. | |
ExtractRoutes($config) | aController | Extract all the APIRoute from this class, regardless of the fact they are registered in the application | |
getVerbosity() | aModule | ||
HasRoutes() | aController | Tells if any APIRoute are registered in the application | |
info($message, $context) | aModule | Interesting events. No-op if INFO is currently filtered out by the verbosity mask. | |
Instantiate($config) | aModule | (Re)create the shared instance immediately, configured with $config merged into the class's existing config. | |
IsShared() | aModule | ||
Link($method, $data) | aController | Build a Link (URL + label/icon/description/title, taken from the route's APIRoute metadata) for a registered route. | |
log($level, $message, $context) | aModule | Logs with an arbitrary level. | |
notice($message, $context) | aModule | Normal but significant events. | |
offsetExists($key) | aModule | \ArrayAccess::offsetExists -- tells whether $key is a declared property at all, regardless of whether it is currently readable/writable through array access. | |
offsetGet($key) | aModule | \ArrayAccess::offsetGet -- reads a property directly, unless it has a #[Serialize(serialize: 'methodName')] attribute, in which case that zero-argument method is called instead (e.g. | |
offsetSet($key, $value) | aModule | \ArrayAccess::offsetSet -- sets a property directly, unless it has a #[Serialize(unserialize: 'methodName')] attribute, in which case that method is called with $value instead (e.g. | |
offsetUnset($key) | aModule | \ArrayAccess::offsetUnset -- equivalent to $module[$key] = null. | |
Route($method) | aController | Get a registered APIRoute WARNING: if this class was not registered in the application, it will return null. | |
Routes() | aController | Get a list of registered APIRoutes (from this class) in the application WARNING: if this class was not registered in the application, it will return an empty array. | |
serialize($path, $serializer) | aModule | \MMO\core\interfaces\iSerializable::serialize -- exports every property (via | |
setVerbosity($verb) | aModule | Set the current verbosity mask, replacing whatever it was before. | |
Shared() | aModule | Get the shared instance, creating (and configuring) it on first call. | |
testVerbosity($level) | aModule | Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask. | |
traitUnshare($serialize) | aModule | Remove the shared instance, so the next Shared() call creates a fresh one. | |
unserialize($data, $path, $instances) | aModule | \MMO\core\interfaces\iSerializable::unserialize -- merges $data onto DefaultConfig, runs it through the (possibly overridden) constructor, then applies each resulting value to its property (via | |
Unshare($serialize) | aModule | Like tSingleton::Unshare, but also disconnects this module's instance from every event it was listening to (via Event::DisconnectListeners) before dropping it. | |
Url($method, $data) | aController | Build the URL for a registered route, filling in any {placeholder} from $data. | |
warning($message, $context) | aModule | Exceptional occurrences that are not errors. | |
__construct($config) | aModule | protected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data. | |
__wakeup() | aController | Called automatically right after the controller's shared instance is built (aModule::unserialize): registers onRoute as a Route listener with a low priority (-10), so it… |