PHP Class Jarves\ACL

Show file Open project: jarves/jarves Class Usage Examples

Protected Properties

Property Type Description
$acls array
$cache array
$caching boolean If we use caching in getRules or not. Useless in testsuits.
$jarves Jarves
$objects Objects

Public Methods

Method 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 method

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 method

public check ( ACLRequest $aclRequest ) : boolean
$aclRequest ACLRequest
return boolean

getCaching() public method

Returns true if caching mechanism is activated.
public getCaching ( ) : boolean
return boolean

getItem() public method

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

getListingCondition() public method

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

getRules() public method

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
return mixed

isDeletable() public method

public isDeletable ( string $objectKey, array $pk = null ) : boolean
$objectKey string
$pk array
return boolean

isUpdatable() public method

public isUpdatable ( string $objectKey, array $pk = null ) : boolean
$objectKey string
$pk array
return boolean

normalizeCode() public method

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 method

public removeObjectRules ( $objectKey )

setCaching() public method

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

setObject() public method

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

setObjectList() public method

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 method

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

setObjectListExact() public method

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

setObjectUpdate() public method

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

Property Details

$acls protected property

protected array $acls
return array

$cache protected property

protected array $cache
return array

$caching protected property

If we use caching in getRules or not. Useless in testsuits.
protected bool $caching
return boolean

$jarves protected property

protected Jarves,jarves $jarves
return Jarves

$objects protected property

protected Objects,jarves $objects
return Objects