Documentation

Bean extends Ajax
in package

Operations on beans

Table of Contents

$context  : Context
$controller  : Ajax
$model  : string
$permissions  : array<string|int, mixed>
__construct()  : mixed
Constructor
handle()  : void
Carry out operations on beans
requires()  : array<string|int, mixed>
Return permission requirements
checkAccess()  : void
Check access to a bean
fieldExists()  : bool
Check that a bean has a field. Do not allow id field to be manipulated.
restCheck()  : array<string|int, mixed>
Check URL string for n parameter values and pull them out
ajaxResult()  : void
Generate a no content, created or call the ajaxResult method on a bean if it exists in its Model
checkPerms()  : void
Check that user has the permissions that are specified in an array
delete()  : void
DELETE /ajax/bean/KIND/ID/
patch()  : void
update a field /ajax/bean/KIND/ID/FIELD/[FN]
post()  : void
make a new one /ajax/bean/KIND/
put()  : void
Map put onto patch

Properties

$model

private string $model = ''

$permissions

private static array<string|int, mixed> $permissions = [ConfigFramework::CONFIG => [TRUE, [[ConfigFramework::FWCONTEXT, ConfigFramework::ADMINROLE]], []], ConfigFramework::FORM => [TRUE, [[ConfigFramework::FWCONTEXT, ConfigFramework::ADMINROLE]], []], ConfigFramework::FORMFIELD => [TRUE, [[ConfigFramework::FWCONTEXT, ConfigFramework::ADMINROLE]], []], ConfigFramework::PAGE => [TRUE, [[ConfigFramework::FWCONTEXT, ConfigFramework::ADMINROLE]], []], ConfigFramework::PAGEROLE => [TRUE, [[ConfigFramework::FWCONTEXT, ConfigFramework::ADMINROLE]], []], ConfigFramework::ROLECONTEXT => [TRUE, [[ConfigFramework::FWCONTEXT, ConfigFramework::ADMINROLE]], []], ConfigFramework::ROLENAME => [TRUE, [[ConfigFramework::FWCONTEXT, ConfigFramework::ADMINROLE]], []], ConfigFramework::TABLE => [TRUE, [[ConfigFramework::FWCONTEXT, ConfigFramework::ADMINROLE]], []], ConfigFramework::USER => [TRUE, [[ConfigFramework::FWCONTEXT, ConfigFramework::ADMINROLE]], []]]

Methods

__construct()

Constructor

public __construct(Context $context, Ajax $controller) : mixed
Parameters
$context : Context
$controller : Ajax
Return values
mixed

requires()

Return permission requirements

public requires() : array<string|int, mixed>
Return values
array<string|int, mixed>

checkAccess()

Check access to a bean

protected final checkAccess(OODBBean|null $user, array<string|int, mixed> $permissions, string $bean[, string $field = '' ][, bool $idOK = FALSE ]) : void
Parameters
$user : OODBBean|null
$permissions : array<string|int, mixed>
$bean : string
$field : string = ''
$idOK : bool = FALSE
Tags
throws
Forbidden
Return values
void

fieldExists()

Check that a bean has a field. Do not allow id field to be manipulated.

protected final fieldExists(string $type, string $field[, bool $idok = FALSE ]) : bool
Parameters
$type : string

The type of bean

$field : string

The field name

$idok : bool = FALSE

Allow the id field

Tags
throws
BadValue
Return values
bool

restCheck()

Check URL string for n parameter values and pull them out

protected restCheck(int $count) : array<string|int, mixed>

The value in $rest[0] is assumed to be an opcode so we always start at $rest[1]

Parameters
$count : int

The number to check for

Tags
throws
ParameterCount
Return values
array<string|int, mixed>

The parameter values in an array indexed from 0 with last parameter, anything left in an array

ajaxResult()

Generate a no content, created or call the ajaxResult method on a bean if it exists in its Model

private ajaxResult(OODBBean $bean, string $method) : void
Parameters
$bean : OODBBean

The bean

$method : string

The method used to get here

Return values
void

checkPerms()

Check that user has the permissions that are specified in an array

private checkPerms(OODBBean|null $user, array<string|int, mixed> $pairs) : void
Parameters
$user : OODBBean|null

The current user or NULL

$pairs : array<string|int, mixed>

The permission array

Tags
throws
Forbidden
psalm-suppress

PossiblyNullReference

Return values
void

delete()

DELETE /ajax/bean/KIND/ID/

private delete(string $beanType, array<string|int, string> $rest, bool $log) : void
Parameters
$beanType : string

The bean type

$rest : array<string|int, string>

The rest of the URL

$log : bool

If TRUE then log the changes

Tags
psalm-suppress

UnusedMethod

phpcsSuppress

SlevomatCodingStandard.Classes.UnusedPrivateElements

Return values
void

patch()

update a field /ajax/bean/KIND/ID/FIELD/[FN]

private patch(string $beanType, array<string|int, string> $rest, bool $log[, string $method = 'patch' ]) : void

If FIELD has the value * then the formdata has several inputs named by field names, if it is a field name then the form contains a single field called value

Parameters
$beanType : string

The bean type

$rest : array<string|int, string>

The rest of the URL

$log : bool

If TRUE then log the changes

$method : string = 'patch'

patch or put - only needed because we are sharing put and patch because of bad routers.

Tags
psalm-suppress

UnusedMethod

phpcsSuppress

SlevomatCodingStandard.Classes.UnusedPrivateElements

Return values
void

post()

make a new one /ajax/bean/KIND/

private post(string $beanType, array<string|int, string> $rest, bool $log) : void
Parameters
$beanType : string

The bean type

$rest : array<string|int, string>

The rest of the URL

$log : bool

If TRUE then log the changes

Tags
psalm-suppress

UnusedMethod

phpcsSuppress

SlevomatCodingStandard.Classes.UnusedPrivateElements

phpcsSuppress

SlevomatCodingStandard.Functions.UnusedParameter

Return values
void

put()

Map put onto patch

private put(string $beanType, array<string|int, string> $rest, bool $log) : void
Parameters
$beanType : string

The bean type

$rest : array<string|int, string>

The rest of the URL

$log : bool

If TRUE then log the changes

Tags
psalm-suppress

UnusedMethod

phpcsSuppress

SlevomatCodingStandard.Classes.UnusedPrivateElements

Return values
void

Search results