PHP Класс Jarves\ACLRequest

$acl->check($request): boolean
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$asParent boolean Defines whether this request should be checked as a parent object. This means, it excludes all rules with sub=0 (rules that do not apply to sub-items/children)
$field string | null | array Example: 'title' or ['language' => 'en']
$mode integer ACL::MODE_ALL, ACL::MODE_LISTING, ACL::MODE_VIEW, ACL::MODE_ADD, ACL::MODE_UPDATE, ACL::MODE_DELETE
$objectKey string Example: jarves/node
$primaryKey array | string | null If not defined, rules that have a constraint to a exactly object item are ignored. This includes: Rules that are applied to parent objects and have sub=true and exact rules that are applied to a particular object item. Actually only ACL::CONSTRAINT_ALL are checked then, usually needed for mode==ACL::LISTING String representation as seen in Jarves\Objects::normalizePkString also allowed and will be converted to a real primaryKey array when used.
$primaryObjectItem null | array When a primaryKey is given and we have rules based on fields of a object item, the ACL system needs to fetch this item based on $primaryKey. To speed things up and to check against not yet created objects (like during a 'add'-check), you should pass the actual objectItem to this request.
$rootHasAccess boolean For nested set, the ACL system iterates through all parents. If no rule applies or all rules are from access=inherited, then this option defines whether ACL::check() returns true or false.
$targetId null | integer If not defined current user id from current session is used.
$targetType null ACL::TARGET_TYPE_USER, ACL::TARGET_TYPE_GROUP

Открытые методы

Метод Описание
__construct ( string $objectKey, string | array | null $primaryKey = null )
create ( string $objectKey, string | array | null $primaryKey = null ) : static
getField ( ) : array | null | string
getMode ( ) : integer
getObjectKey ( ) : string
getPrimaryKey ( ) : array | null
getPrimaryObjectItem ( ) : array | string | null
getTargetId ( ) : integer | null
getTargetType ( ) : null
isAsParent ( ) : boolean
isRootHasAccess ( ) : boolean
onlyAddMode ( )
onlyDeleteMode ( )
onlyListingMode ( )
onlyUpdateMode ( )
onlyViewMode ( )
setAsParent ( boolean $asParent )
setField ( array | null | string $field )
setMode ( integer $mode )
setObjectKey ( string $objectKey )
setPrimaryKey ( string | array | null $primaryKey )
setPrimaryObjectItem ( array $primaryObjectItem = null )
setRootHasAccess ( boolean $rootHasAccess )
setTargetId ( integer | null $targetId )
setTargetType ( null $targetType )
targetGroup ( integer $groupId ) Sets targetId= $groupId and targetType = ACL::TARGET_TYPE_GROUP
targetUser ( integer $userId ) Sets targetId= $userId and targetType = ACL::TARGET_TYPE_USER

Описание методов

__construct() публичный Метод

public __construct ( string $objectKey, string | array | null $primaryKey = null )
$objectKey string
$primaryKey string | array | null see ACLRequest::$primaryKey

create() публичный статический Метод

public static create ( string $objectKey, string | array | null $primaryKey = null ) : static
$objectKey string
$primaryKey string | array | null see ACLRequest::$primaryKey
Результат static

getField() публичный Метод

public getField ( ) : array | null | string
Результат array | null | string

getMode() публичный Метод

public getMode ( ) : integer
Результат integer

getObjectKey() публичный Метод

public getObjectKey ( ) : string
Результат string

getPrimaryKey() публичный Метод

public getPrimaryKey ( ) : array | null
Результат array | null

getPrimaryObjectItem() публичный Метод

public getPrimaryObjectItem ( ) : array | string | null
Результат array | string | null

getTargetId() публичный Метод

public getTargetId ( ) : integer | null
Результат integer | null

getTargetType() публичный Метод

public getTargetType ( ) : null
Результат null

isAsParent() публичный Метод

public isAsParent ( ) : boolean
Результат boolean

isRootHasAccess() публичный Метод

public isRootHasAccess ( ) : boolean
Результат boolean

onlyAddMode() публичный Метод

public onlyAddMode ( )

onlyDeleteMode() публичный Метод

public onlyDeleteMode ( )

onlyListingMode() публичный Метод

public onlyListingMode ( )

onlyUpdateMode() публичный Метод

public onlyUpdateMode ( )

onlyViewMode() публичный Метод

public onlyViewMode ( )

setAsParent() публичный Метод

public setAsParent ( boolean $asParent )
$asParent boolean

setField() публичный Метод

public setField ( array | null | string $field )
$field array | null | string

setMode() публичный Метод

public setMode ( integer $mode )
$mode integer ACL::MODE_ALL, ACL::MODE_LISTING, ACL::MODE_VIEW, ACL::MODE_ADD, ACL::MODE_UPDATE, ACL::MODE_DELETE

setObjectKey() публичный Метод

public setObjectKey ( string $objectKey )
$objectKey string

setPrimaryKey() публичный Метод

public setPrimaryKey ( string | array | null $primaryKey )
$primaryKey string | array | null see ACLRequest::$primaryKey

setPrimaryObjectItem() публичный Метод

public setPrimaryObjectItem ( array $primaryObjectItem = null )
$primaryObjectItem array

setRootHasAccess() публичный Метод

public setRootHasAccess ( boolean $rootHasAccess )
$rootHasAccess boolean

setTargetId() публичный Метод

public setTargetId ( integer | null $targetId )
$targetId integer | null

setTargetType() публичный Метод

public setTargetType ( null $targetType )
$targetType null

targetGroup() публичный Метод

Sets targetId= $groupId and targetType = ACL::TARGET_TYPE_GROUP
public targetGroup ( integer $groupId )
$groupId integer

targetUser() публичный Метод

Sets targetId= $userId and targetType = ACL::TARGET_TYPE_USER
public targetUser ( integer $userId )
$userId integer

Описание свойств

$asParent защищенное свойство

Defines whether this request should be checked as a parent object. This means, it excludes all rules with sub=0 (rules that do not apply to sub-items/children)
protected bool $asParent
Результат boolean

$field защищенное свойство

Example: 'title' or ['language' => 'en']
protected string|null|array $field
Результат string | null | array

$mode защищенное свойство

ACL::MODE_ALL, ACL::MODE_LISTING, ACL::MODE_VIEW, ACL::MODE_ADD, ACL::MODE_UPDATE, ACL::MODE_DELETE
protected int $mode
Результат integer

$objectKey защищенное свойство

Example: jarves/node
protected string $objectKey
Результат string

$primaryKey защищенное свойство

If not defined, rules that have a constraint to a exactly object item are ignored. This includes: Rules that are applied to parent objects and have sub=true and exact rules that are applied to a particular object item. Actually only ACL::CONSTRAINT_ALL are checked then, usually needed for mode==ACL::LISTING String representation as seen in Jarves\Objects::normalizePkString also allowed and will be converted to a real primaryKey array when used.
protected array|string|null $primaryKey
Результат array | string | null

$primaryObjectItem защищенное свойство

When a primaryKey is given and we have rules based on fields of a object item, the ACL system needs to fetch this item based on $primaryKey. To speed things up and to check against not yet created objects (like during a 'add'-check), you should pass the actual objectItem to this request.
protected null|array $primaryObjectItem
Результат null | array

$rootHasAccess защищенное свойство

For nested set, the ACL system iterates through all parents. If no rule applies or all rules are from access=inherited, then this option defines whether ACL::check() returns true or false.
protected bool $rootHasAccess
Результат boolean

$targetId защищенное свойство

If not defined current user id from current session is used.
protected null|int $targetId
Результат null | integer

$targetType защищенное свойство

ACL::TARGET_TYPE_USER, ACL::TARGET_TYPE_GROUP
protected null $targetType
Результат null