Handler
extends SecuredServerPlugin
in package
Define a system plugin
Extended version of the server plugin with additional permission layer based on roles
Table of Contents
- $config : stdClass|null
- Buffer for configuration
- $defaultPermissions : array<string|int, mixed>
- The default permission set
- $dir : string
- The implementation directory
- $name : string
- Name of the plugin
- $backend : Backend|null
- Instance of the backend class
- $req : Request|null
- Store request Holds the request object instance
- __construct() : mixed
- set the plugin name
- GetAccessList() : array<string|int, mixed>
- Name() : string
- OnAfterUserLoginByPassword() : mixed
- Called on after login before register the session
- OnBeforeRegisterUser() : mixed
- OnGetGdprRelevantServiceImplementations() : mixed
- OnMapArrayIncludes() : mixed
- OnRegisterWidgetIncludes() : mixed
- OnWebLogin() : mixed
- Called before login function when the items
- RegisterHooks() : array<string|int, mixed>
- register system hooks Register a set of handler functions to be called in certain positions.
- RequestOnUrlParsed() : mixed
- ServeRequest() : mixed
- Serve request Serve the request and return appropriate result.
- settings() : Result|object
- Get/Set the settings
- SetupTemplate() : mixed
- handleConfig() : void
- Handle the context requests
- hasAccess() : bool
- Check if endpoint is accessible for this user group
- isInContext() : bool
- Is in certain context?
- setupAttributes() : void
- Set up the permission attribute table
- base64_url_decode() : false|string
- Parse the token content
- GetUser() : User|bool
- Get our user
- handleConfigPreset() : mixed
- Handle the context requests
- handleLogin() : void
- Handle the login
- parseSignedRequest() : Result|null
- Parse the signed request to object
- Request() : Request
- Get request Get the stored request object of the http call.
- revokeCallback() : mixed
- Called from facebook api when the user does a signout operation
- shariffCallback() : void
- Handle call to facebook share counter
- shariffClient() : Backend
- Get the shariff client or, null when not active
Properties
$config
Buffer for configuration
protected
stdClass|null
$config
= null
$defaultPermissions
The default permission set
protected
array<string|int, mixed>
$defaultPermissions
= [['endpoint' => 'config', 'root' => true, 'admin' => true]]
$dir
The implementation directory
protected
string
$dir
= ''
$name
Name of the plugin
protected
string
$name
= ''
$backend
Instance of the backend class
private
Backend|null
$backend
= null
$req
Store request Holds the request object instance
private
Request|null
$req
= null
A system request instance
Methods
__construct()
set the plugin name
public
__construct() : mixed
Handler constructor.
Return values
mixed —GetAccessList()
public
GetAccessList(User $user) : array<string|int, mixed>
Parameters
- $user : User
Return values
array<string|int, mixed> —Name()
public
Name() : string
Return values
string —OnAfterUserLoginByPassword()
Called on after login before register the session
public
OnAfterUserLoginByPassword(HookArgument $param) : mixed
Parameters
- $param : HookArgument
Return values
mixed —OnBeforeRegisterUser()
public
OnBeforeRegisterUser(HookArgument $param) : mixed
Parameters
- $param : HookArgument
Return values
mixed —OnGetGdprRelevantServiceImplementations()
public
OnGetGdprRelevantServiceImplementations(HookArgument $param) : mixed
Parameters
- $param : HookArgument
Return values
mixed —OnMapArrayIncludes()
public
OnMapArrayIncludes( $param) : mixed
Parameters
Return values
mixed —OnRegisterWidgetIncludes()
public
OnRegisterWidgetIncludes(HookArgument &$param) : mixed
Parameters
- $param : HookArgument
Return values
mixed —OnWebLogin()
Called before login function when the items
public
OnWebLogin(HookArgument $param) : mixed
Parameters
- $param : HookArgument
Return values
mixed —RegisterHooks()
register system hooks Register a set of handler functions to be called in certain positions.
public
RegisterHooks() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of hooks to register
RequestOnUrlParsed()
public
RequestOnUrlParsed(HookArgument $param) : mixed
Parameters
- $param : HookArgument
Return values
mixed —ServeRequest()
Serve request Serve the request and return appropriate result.
public
ServeRequest(Request $request, Response $response) : mixed
Parameters
Return values
mixed —settings()
Get/Set the settings
public
settings([null|object $new = null ]) : Result|object
This method is cached per instance
Parameters
- $new : null|object = null
-
New set of settings to store
Return values
Result|object —SetupTemplate()
public
SetupTemplate([mixed $data = null ]) : mixed
Parameters
- $data : mixed = null
Tags
Return values
mixed —handleConfig()
Handle the context requests
protected
handleConfig(Request &$request, Response &$response) : void
Parameters
Return values
void —hasAccess()
Check if endpoint is accessible for this user group
protected
hasAccess(string|array<string|int, string> $right[, Response|null $response = null ][, User|null $user = null ]) : bool
Parameters
Return values
bool —isInContext()
Is in certain context?
protected
isInContext(HookArgument $param, string $type, string $widget) : bool
Parameters
- $param : HookArgument
-
The hook argument
- $type : string
-
The type can be scss, css and js to search in widgets or _ to search in global includes
- $widget : string
-
The widget to search for
Return values
bool —setupAttributes()
Set up the permission attribute table
protected
setupAttributes( &$attributes, $l) : void
Parameters
Return values
void —base64_url_decode()
Parse the token content
private
base64_url_decode( $input) : false|string
Parameters
Return values
false|string —GetUser()
Get our user
private
GetUser(string|null $user_id, string|null $language) : User|bool
Get the user by graph user instance
Parameters
- $user_id : string|null
-
A facebook id
- $language : string|null
-
The request language
Return values
User|bool —A system user object or false when error occurred or, null when no user found
handleConfigPreset()
Handle the context requests
private
handleConfigPreset(Request $request, Response $response) : mixed
Parameters
Return values
mixed —handleLogin()
Handle the login
private
handleLogin(Response $response) : void
Parameters
- $response : Response
Return values
void —parseSignedRequest()
Parse the signed request to object
private
parseSignedRequest( $signed_request) : Result|null
Parameters
Return values
Result|null —Request()
Get request Get the stored request object of the http call.
private
Request() : Request
Return values
Request —The request object
revokeCallback()
Called from facebook api when the user does a signout operation
private
revokeCallback(Response $response) : mixed
Parameters
- $response : Response
Return values
mixed —shariffCallback()
Handle call to facebook share counter
private
shariffCallback(Response $response) : void
Parameters
- $response : Response
Return values
void —shariffClient()
Get the shariff client or, null when not active
private
shariffClient() : Backend