PHP Class Jarves\ACLRequest

$acl->check($request): boolean
Afficher le fichier Open project: jarves/jarves Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Method Details

__construct() public méthode

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

create() public static méthode

public static create ( string $objectKey, string | array | null $primaryKey = null ) : static
$objectKey string
$primaryKey string | array | null see ACLRequest::$primaryKey
Résultat static

getField() public méthode

public getField ( ) : array | null | string
Résultat array | null | string

getMode() public méthode

public getMode ( ) : integer
Résultat integer

getObjectKey() public méthode

public getObjectKey ( ) : string
Résultat string

getPrimaryKey() public méthode

public getPrimaryKey ( ) : array | null
Résultat array | null

getPrimaryObjectItem() public méthode

public getPrimaryObjectItem ( ) : array | string | null
Résultat array | string | null

getTargetId() public méthode

public getTargetId ( ) : integer | null
Résultat integer | null

getTargetType() public méthode

public getTargetType ( ) : null
Résultat null

isAsParent() public méthode

public isAsParent ( ) : boolean
Résultat boolean

isRootHasAccess() public méthode

public isRootHasAccess ( ) : boolean
Résultat boolean

onlyAddMode() public méthode

public onlyAddMode ( )

onlyDeleteMode() public méthode

public onlyDeleteMode ( )

onlyListingMode() public méthode

public onlyListingMode ( )

onlyUpdateMode() public méthode

public onlyUpdateMode ( )

onlyViewMode() public méthode

public onlyViewMode ( )

setAsParent() public méthode

public setAsParent ( boolean $asParent )
$asParent boolean

setField() public méthode

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

setMode() public méthode

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 méthode

public setObjectKey ( string $objectKey )
$objectKey string

setPrimaryKey() public méthode

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

setPrimaryObjectItem() public méthode

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

setRootHasAccess() public méthode

public setRootHasAccess ( boolean $rootHasAccess )
$rootHasAccess boolean

setTargetId() public méthode

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

setTargetType() public méthode

public setTargetType ( null $targetType )
$targetType null

targetGroup() public méthode

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

targetUser() public méthode

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

Property Details

$asParent protected_oe property

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
Résultat boolean

$field protected_oe property

Example: 'title' or ['language' => 'en']
protected string|null|array $field
Résultat string | null | array

$mode protected_oe property

ACL::MODE_ALL, ACL::MODE_LISTING, ACL::MODE_VIEW, ACL::MODE_ADD, ACL::MODE_UPDATE, ACL::MODE_DELETE
protected int $mode
Résultat integer

$objectKey protected_oe property

Example: jarves/node
protected string $objectKey
Résultat string

$primaryKey protected_oe property

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
Résultat array | string | null

$primaryObjectItem protected_oe property

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
Résultat null | array

$rootHasAccess protected_oe property

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
Résultat boolean

$targetId protected_oe property

If not defined current user id from current session is used.
protected null|int $targetId
Résultat null | integer

$targetType protected_oe property

ACL::TARGET_TYPE_USER, ACL::TARGET_TYPE_GROUP
protected null $targetType
Résultat null