PHP Класс Jarves\ACL

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$acls array
$cache array
$caching boolean If we use caching in getRules or not. Useless in testsuits.
$jarves Jarves
$objects Objects

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

Метод Описание
__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 )

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

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

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 check ( ACLRequest $aclRequest ) : boolean
$aclRequest ACLRequest
Результат boolean

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

Returns true if caching mechanism is activated.
public getCaching ( ) : boolean
Результат boolean

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

Returns the acl infos for the specified id
public getItem ( string $object, integer $code ) : array
$object string
$code integer
Результат array

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

Get a condition object for item listings.
public getListingCondition ( string $objectKey ) : Condition
$objectKey string
Результат Jarves\Configuration\Condition

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

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
Результат mixed

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

public isDeletable ( string $objectKey, array $pk = null ) : boolean
$objectKey string
$pk array
Результат boolean

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

public isUpdatable ( string $objectKey, array $pk = null ) : boolean
$objectKey string
$pk array
Результат boolean

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

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 removeObjectRules ( $objectKey )

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

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

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

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

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

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 setObjectListCondition ( $objectKey, $condition, $targetType, $targetId, $access, $fields = null, $withSub = false )

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

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

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

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

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

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

protected array $acls
Результат array

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

protected array $cache
Результат array

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

If we use caching in getRules or not. Useless in testsuits.
protected bool $caching
Результат boolean

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

protected Jarves,jarves $jarves
Результат Jarves

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

protected Objects,jarves $objects
Результат Objects