PHP Class Jarves\ACL

Afficher le fichier Open project: jarves/jarves Class Usage Examples

Protected Properties

Свойство Type Description
$acls array
$cache array
$caching boolean If we use caching in getRules or not. Useless in testsuits.
$jarves Jarves
$objects Objects

Méthodes publiques

Méthode Description
__construct ( Jarves $jarves, Objects $objects, PageStack $pageStack, Cacher $cacher, ConditionOperator $conditionOperator ) ACL constructor.
check ( ACLRequest $aclRequest ) : boolean
getCaching ( ) : boolean Returns true if caching mechanism is activated.
getItem ( string $object, integer $code ) : array Returns the acl infos for the specified id
getListingCondition ( string $objectKey ) : Condition Get a condition object for item listings.
getRules ( $objectKey, integer $mode = 1, integer | null $targetType = ACL::TARGET_TYPE_USER, integer | null $targetId = null ) : mixed Mode table:
isDeletable ( string $objectKey, array $pk = null ) : boolean
isUpdatable ( string $objectKey, array $pk = null ) : boolean
normalizeCode ( &$code ) * public function set($pType, $pTargetType, $pTargetId, $pCode, $pActions, $pWithSub) { self::normalizeCode($pCode); $pType += 0; $pTargetType += $pTargetType; $pTargetId += $pTargetId; $pCode = esc($pCode);
removeObjectRules ( $objectKey )
setCaching ( $caching ) Activates or disables the caching mechanism.
setObject ( $mode, $objectKey, $constraintType, $constraintCode, $withSub = false, $targetType, $targetId, $access, $fields = null )
setObjectList ( $objectKey, $targetType, $targetId, $access, $fields = null, $withSub = false ) * public function checkRead($pObjectKey, $pObjectId, $pField = false) { return self::check($pObjectKey, $pObjectId, $pField, 2); }
setObjectListCondition ( $objectKey, $condition, $targetType, $targetId, $access, $fields = null, $withSub = false )
setObjectListExact ( $objectKey, $objectPk, $targetType, $targetId, $access, $fields = null, $withSub = false )
setObjectUpdate ( $objectKey, $targetType, $targetId, $access, $fields = null, $withSub = false )

Method Details

__construct() public méthode

ACL constructor.
public __construct ( Jarves $jarves, Objects $objects, PageStack $pageStack, Cacher $cacher, ConditionOperator $conditionOperator )
$jarves Jarves
$objects Objects
$pageStack PageStack
$cacher Jarves\Cache\Cacher
$conditionOperator ConditionOperator

check() public méthode

public check ( ACLRequest $aclRequest ) : boolean
$aclRequest ACLRequest
Résultat boolean

getCaching() public méthode

Returns true if caching mechanism is activated.
public getCaching ( ) : boolean
Résultat boolean

getItem() public méthode

Returns the acl infos for the specified id
public getItem ( string $object, integer $code ) : array
$object string
$code integer
Résultat array

getListingCondition() public méthode

Get a condition object for item listings.
public getListingCondition ( string $objectKey ) : Condition
$objectKey string
Résultat Jarves\Configuration\Condition

getRules() public méthode

0 all 1 list 2 view 3 add 4 update 5 delete
public getRules ( $objectKey, integer $mode = 1, integer | null $targetType = ACL::TARGET_TYPE_USER, integer | null $targetId = null ) : mixed
$objectKey
$mode integer
$targetType integer | null
$targetId integer | null
Résultat mixed

isDeletable() public méthode

public isDeletable ( string $objectKey, array $pk = null ) : boolean
$objectKey string
$pk array
Résultat boolean

isUpdatable() public méthode

public isUpdatable ( string $objectKey, array $pk = null ) : boolean
$objectKey string
$pk array
Résultat boolean

normalizeCode() public méthode

self::removeAcl($pType, $pTargetType, $pTargetId, $pCode); if ($pWithSub) $pCode .= '%'; $pCode = '[' . implode(',', $pActions) . ']'; $last_id = dbInsert('system_acl', array( 'type' => $pType, 'target_type' => $pTargetType, 'target_id' => $pTargetId, 'code' => $pCode )); $this->cache[$pType] = null; return $last_id; } public function remove($pType, $pTargetType, $pTargetId, $pCode) { self::normalizeCode($pCode); $pType += 0; $pTargetType += $pTargetType; $pTargetId += $pTargetId; $pCode = esc($pCode); dbDelete('system_acl', "1=1 AND type = $pType AND target_type = $pTargetType AND target_id = $pTargetId AND code LIKE '$pCode%'"); $this->cache[$pType] = null; }
public normalizeCode ( &$code )

removeObjectRules() public méthode

public removeObjectRules ( $objectKey )

setCaching() public méthode

Activates or disables the caching mechanism.
public setCaching ( $caching )
$caching

setObject() public méthode

public setObject ( $mode, $objectKey, $constraintType, $constraintCode, $withSub = false, $targetType, $targetId, $access, $fields = null )

setObjectList() public méthode

public function checkAdd($pObjectKey, $pParentId, $pField = false) { return self::check($pObjectKey, $pParentId, $pField, 3, false, true); } public function checkUpdate($pObjectKey, $pObjectId, $pField = false) { return self::check($pObjectKey, $pObjectId, $pField, 3); }
public setObjectList ( $objectKey, $targetType, $targetId, $access, $fields = null, $withSub = false )

setObjectListCondition() public méthode

public setObjectListCondition ( $objectKey, $condition, $targetType, $targetId, $access, $fields = null, $withSub = false )

setObjectListExact() public méthode

public setObjectListExact ( $objectKey, $objectPk, $targetType, $targetId, $access, $fields = null, $withSub = false )

setObjectUpdate() public méthode

public setObjectUpdate ( $objectKey, $targetType, $targetId, $access, $fields = null, $withSub = false )

Property Details

$acls protected_oe property

protected array $acls
Résultat array

$cache protected_oe property

protected array $cache
Résultat array

$caching protected_oe property

If we use caching in getRules or not. Useless in testsuits.
protected bool $caching
Résultat boolean

$jarves protected_oe property

protected Jarves,jarves $jarves
Résultat Jarves

$objects protected_oe property

protected Objects,jarves $objects
Résultat Objects