Class lispa\amos\core\rbac\DbManagerCached

Inheritancelispa\amos\core\rbac\DbManagerCached » lispa\amos\core\rbac\AuthManager » yii\rbac\DbManager » yii\rbac\BaseManager » yii\base\Component » yii\base\Object
Implementsyii\base\Configurable, yii\rbac\ManagerInterface

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$assignmentTable string The name of the table storing authorization item assignments. yii\rbac\DbManager
$behaviors yii\base\Behavior[] List of behaviors attached to this component yii\base\Component
$cache string The ID of the cache application component that is used to cache rbac. lispa\amos\core\rbac\DbManagerCached
$cacheDuration integer Lifetime of cached data in seconds lispa\amos\core\rbac\DbManagerCached
$cacheKey string The key used to store RBAC data in cache yii\rbac\DbManager
$cacheKeyName string Cache key name lispa\amos\core\rbac\DbManagerCached
$db yii\db\Connection|array|string The DB connection object or the application component ID of the DB connection. yii\rbac\DbManager
$defaultRoleInstances yii\rbac\Role[] Default roles. yii\rbac\BaseManager
$defaultRoles array A list of role names that are assigned to every user automatically without calling assign(). yii\rbac\BaseManager
$itemChildTable string The name of the table storing authorization item hierarchy. yii\rbac\DbManager
$itemTable string The name of the table storing authorization items. yii\rbac\DbManager
$permissions yii\rbac\Permission[] All permissions in the system. yii\rbac\BaseManager
$roles yii\rbac\Role[] All roles in the system. yii\rbac\BaseManager
$ruleTable string The name of the table storing rules. yii\rbac\DbManager

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$cachedData array Php cache lispa\amos\core\rbac\DbManagerCached
$items yii\rbac\Item[] All auth items (name => Item) yii\rbac\DbManager
$parents array Auth item parent-child relationships (childName => list of parents) yii\rbac\DbManager
$rules yii\rbac\Rule[] All auth rules (name => Rule) yii\rbac\DbManager

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\Object
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
add() Adds a role, permission or rule to the RBAC system. yii\rbac\BaseManager
addChild() Adds an item as a child of another item. yii\rbac\DbManager
assign() Assigns a role to a user. yii\rbac\DbManager
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
canAddChild() Checks the possibility of adding a child to parent yii\rbac\DbManager
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
checkAccess() lispa\amos\core\rbac\DbManagerCached
className() Returns the fully qualified name of this class. yii\base\Object
createPermission() Creates a new Permission object. yii\rbac\BaseManager
createRole() Creates a new Role object. yii\rbac\BaseManager
deleteAllCache() Get cached value lispa\amos\core\rbac\DbManagerCached
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
getAssignment() Returns the assignment information regarding a role and a user. yii\rbac\DbManager
getAssignments() Returns all role assignment information for the specified user. lispa\amos\core\rbac\DbManagerCached
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getChildRoles() Returns child roles of the role specified. Depth isn't limited. yii\rbac\DbManager
getChildren() Returns the child permissions and/or roles. yii\rbac\DbManager
getDefaultRoleInstances() Returns defaultRoles as array of Role objects yii\rbac\BaseManager
getParents() lispa\amos\core\rbac\DbManagerCached
getPermission() Returns the named permission. yii\rbac\BaseManager
getPermissions() Returns all permissions in the system. yii\rbac\BaseManager
getPermissionsByRole() Returns all permissions that the specified role represents. yii\rbac\DbManager
getPermissionsByUser() Returns all permissions that the user has. yii\rbac\DbManager
getRole() Returns the named role. yii\rbac\BaseManager
getRoles() Returns all roles in the system. yii\rbac\BaseManager
getRolesByUser() Returns the roles that are assigned to the user via assign(). yii\rbac\DbManager
getRule() Returns the rule of the specified name. yii\rbac\DbManager
getRules() Returns all rules available in the system. yii\rbac\DbManager
getUserIdsByRole() lispa\amos\core\rbac\AuthManager
getUserIdsByRoleDirectlyAssigned() lispa\amos\core\rbac\AuthManager
hasChild() Returns a value indicating whether the child already exists for the parent. yii\rbac\DbManager
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() Initializes the application component. yii\rbac\DbManager
invalidateCache() lispa\amos\core\rbac\DbManagerCached
loadFromCache() yii\rbac\DbManager
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
remove() Removes a role, permission or rule from the RBAC system. yii\rbac\BaseManager
removeAll() Removes all authorization data, including roles, permissions, rules, and assignments. yii\rbac\DbManager
removeAllAssignments() Removes all role assignments. yii\rbac\DbManager
removeAllPermissions() Removes all permissions. yii\rbac\DbManager
removeAllRoles() Removes all roles. yii\rbac\DbManager
removeAllRules() Removes all rules. yii\rbac\DbManager
removeChild() Removes a child from its parent. yii\rbac\DbManager
removeChildren() Removed all children form their parent. yii\rbac\DbManager
revoke() Revokes a role from a user. yii\rbac\DbManager
revokeAll() Revokes all roles from a user. yii\rbac\DbManager
trigger() Triggers an event. yii\base\Component
update() Updates the specified role, permission or rule in the system. yii\rbac\BaseManager

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
addItem() Adds an auth item to the RBAC system. yii\rbac\DbManager
addRule() Adds a rule to the RBAC system. yii\rbac\DbManager
checkAccessFromCache() Performs access check for the specified user based on the data loaded from cache. yii\rbac\DbManager
checkAccessRecursive() Performs access check for the specified user. lispa\amos\core\rbac\DbManagerCached
detectLoop() Checks whether there is a loop in the authorization item hierarchy. yii\rbac\DbManager
executeRule() Executes the rule associated with the specified auth item. yii\rbac\BaseManager
getCache() Get cached value lispa\amos\core\rbac\DbManagerCached
getChildrenList() Returns the children for every parent. yii\rbac\DbManager
getChildrenRecursive() Recursively finds all children and grand children of the specified item. yii\rbac\DbManager
getDirectPermissionsByUser() Returns all permissions that are directly assigned to user. yii\rbac\DbManager
getInheritedPermissionsByUser() Returns all permissions that the user inherits from the roles assigned to him. yii\rbac\DbManager
getItem() Returns the named auth item. lispa\amos\core\rbac\DbManagerCached
getItems() Returns the items of the specified type. yii\rbac\DbManager
hasNoAssignments() Checks whether array of $assignments is empty and $defaultRoles property is empty as well yii\rbac\BaseManager
populateItem() Populates an auth item with the data fetched from database yii\rbac\DbManager
removeAllItems() Removes all auth items of the specified type. yii\rbac\DbManager
removeItem() Removes an auth item from the RBAC system. yii\rbac\DbManager
removeRule() Removes a rule from the RBAC system. yii\rbac\DbManager
resolveCacheComponent() Returns cache component configured as in cacheId lispa\amos\core\rbac\DbManagerCached
setCache() Set a value in cache lispa\amos\core\rbac\DbManagerCached
supportsCascadeUpdate() Returns a value indicating whether the database supports cascading update and delete. yii\rbac\DbManager
updateItem() Updates an auth item in the RBAC system. yii\rbac\DbManager
updateRule() Updates a rule to the RBAC system. yii\rbac\DbManager

Property Details

$cache public property

The ID of the cache application component that is used to cache rbac. Defaults to 'cache' which refers to the primary cache application component.

public string $cache 'cache'
$cacheDuration public property

Lifetime of cached data in seconds

public integer $cacheDuration 86400
$cacheKeyName public property

Cache key name

public string $cacheKeyName 'RbacCached'
$cachedData protected property

Php cache

protected array $cachedData = []

Method Details

checkAccess() public method

public void checkAccess ( $userId, $permissionName, $params = [] )
$userId
$permissionName
$params
checkAccessRecursive() protected method

Performs access check for the specified user.

This method is internally called by checkAccess().

protected boolean checkAccessRecursive ( $user, $itemName, $params, $assignments )
$user string|integer

The user ID. This should can be either an integer or a string representing the unique identifier of a user. See yii\web\User::$id.

$itemName string

The name of the operation that need access check

$params array

Name-value pairs that would be passed to rules associated with the tasks and roles assigned to the user. A param with name 'user' is added to this array, which holds the value of $userId.

$assignments yii\rbac\Assignment[]

The assignments to the specified user

return boolean

Whether the operations can be performed by the user.

deleteAllCache() public method

Get cached value

public mixed deleteAllCache ( )
getAssignments() public method

Returns all role assignment information for the specified user.

public yii\rbac\Assignment[] getAssignments ( $userId )
$userId string|integer

The user ID (see yii\web\User::$id)

return yii\rbac\Assignment[]

The assignments indexed by role names. An empty array will be returned if there is no role assigned to the user.

getCache() protected method

Get cached value

protected mixed getCache ( $key )
$key
getItem() protected method

Returns the named auth item.

protected yii\rbac\Item getItem ( $name )
$name string

The auth item name.

return yii\rbac\Item

The auth item corresponding to the specified name. Null is returned if no such item.

getParents() public method

public array getParents ( $roleName )
$roleName string
invalidateCache() public method

public void invalidateCache ( )
resolveCacheComponent() protected method

Returns cache component configured as in cacheId

protected \lispa\amos\core\rbac\Cache resolveCacheComponent ( )
setCache() protected method

Set a value in cache

protected mixed setCache ( $key, $value )
$key
$value