0 follower

Interface Yiisoft\Rbac\ItemsStorageInterface

Implemented byYiisoft\Rbac\SimpleItemsStorage

A storage for RBAC roles and permissions used in Yiisoft\Rbac\Manager.

Public Methods

Hide inherited methods

Method Description Defined By
add() Adds the role or the permission to RBAC system. Yiisoft\Rbac\ItemsStorageInterface
addChild() Adds a role or a permission as a child of another role or permission. Yiisoft\Rbac\ItemsStorageInterface
clear() Removes all roles and permissions. Yiisoft\Rbac\ItemsStorageInterface
clearPermissions() Removes all permissions. Yiisoft\Rbac\ItemsStorageInterface
clearRoles() Removes all roles. Yiisoft\Rbac\ItemsStorageInterface
exists() Whether a named role or permission exists. Yiisoft\Rbac\ItemsStorageInterface
get() Returns the named role or permission. Yiisoft\Rbac\ItemsStorageInterface
getAll() Returns all roles and permissions in the system. Yiisoft\Rbac\ItemsStorageInterface
getAllChildPermissions() Returns all child permissions. Yiisoft\Rbac\ItemsStorageInterface
getAllChildRoles() Returns all child roles. Yiisoft\Rbac\ItemsStorageInterface
getAllChildren() Returns all child permissions and/or roles. Yiisoft\Rbac\ItemsStorageInterface
getByNames() Returns roles and permission by the given names' list. Yiisoft\Rbac\ItemsStorageInterface
getDirectChildren() Returns direct child permissions and/or roles. Yiisoft\Rbac\ItemsStorageInterface
getHierarchy() Returns the parents tree for a single item which additionally contains children for each parent (only among the found items). The base item is included too, its children list is always empty. Yiisoft\Rbac\ItemsStorageInterface
getParents() Returns the parent permissions and/or roles. Yiisoft\Rbac\ItemsStorageInterface
getPermission() Returns the named permission. Yiisoft\Rbac\ItemsStorageInterface
getPermissions() Returns all permissions in the system. Yiisoft\Rbac\ItemsStorageInterface
getPermissionsByNames() Returns permissions by the given names' list. Yiisoft\Rbac\ItemsStorageInterface
getRole() Returns the named role. Yiisoft\Rbac\ItemsStorageInterface
getRoles() Returns all roles in the system. Yiisoft\Rbac\ItemsStorageInterface
getRolesByNames() Returns roles by the given names' list. Yiisoft\Rbac\ItemsStorageInterface
hasChild() Returns whether selected parent has a child with a given name. Yiisoft\Rbac\ItemsStorageInterface
hasChildren() Returns whether named parent has children. Yiisoft\Rbac\ItemsStorageInterface
hasDirectChild() Returns whether selected parent has a direct child with a given name. Yiisoft\Rbac\ItemsStorageInterface
remove() Removes a role or permission from the RBAC system. Yiisoft\Rbac\ItemsStorageInterface
removeChild() Removes a child from its parent. Yiisoft\Rbac\ItemsStorageInterface
removeChildren() Removed all children form their parent. Yiisoft\Rbac\ItemsStorageInterface
roleExists() Whether a named role exists. Yiisoft\Rbac\ItemsStorageInterface
update() Updates the specified role or permission in the system. Yiisoft\Rbac\ItemsStorageInterface

Method Details

Hide inherited methods

add() public abstract method

Adds the role or the permission to RBAC system.

public abstract add( Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role $item ): void
$item Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role

The role or the permission to add.

                public function add(Permission|Role $item): void;

            
addChild() public abstract method

Adds a role or a permission as a child of another role or permission.

public abstract addChild( string $parentName, string $childName ): void
$parentName string

Name of the parent to add child to.

$childName string

Name of the child to add.

                public function addChild(string $parentName, string $childName): void;

            
clear() public abstract method

Removes all roles and permissions.

public abstract clear( ): void

                public function clear(): void;

            
clearPermissions() public abstract method

Removes all permissions.

All parent child relations will be adjusted accordingly.

public abstract clearPermissions( ): void

                public function clearPermissions(): void;

            
clearRoles() public abstract method

Removes all roles.

All parent child relations will be adjusted accordingly.

public abstract clearRoles( ): void

                public function clearRoles(): void;

            
exists() public abstract method

Whether a named role or permission exists.

public abstract exists( string $name ): boolean
$name string

The role or the permission name.

return boolean

Whether a named role or permission exists.

                public function exists(string $name): bool;

            
get() public abstract method

Returns the named role or permission.

public abstract get( string $name ): Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role|null
$name string

The role or the permission name.

return Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role|null

The role or the permission corresponding to the specified name. null is returned if there is no such item.

                public function get(string $name): Permission|Role|null;

            
getAll() public abstract method

Returns all roles and permissions in the system.

public abstract getAll( ): array
return array

All roles and permissions in the system.

                public function getAll(): array;

            
getAllChildPermissions() public abstract method

Returns all child permissions.

public abstract getAllChildPermissions( string|string[] $names ): Yiisoft\Rbac\Permission[]
$names string|string[]

The parent name / names.

return Yiisoft\Rbac\Permission[]

The child permissions.

                public function getAllChildPermissions(string|array $names): array;

            
getAllChildRoles() public abstract method

Returns all child roles.

public abstract getAllChildRoles( string|string[] $names ): Yiisoft\Rbac\Role[]
$names string|string[]

The parent name / names.

return Yiisoft\Rbac\Role[]

The child roles.

                public function getAllChildRoles(string|array $names): array;

            
getAllChildren() public abstract method

Returns all child permissions and/or roles.

public abstract getAllChildren( string|string[] $names ): array
$names string|string[]

The parent name / names.

return array

The child permissions and/or roles.

                public function getAllChildren(string|array $names): array;

            
getByNames() public abstract method

Returns roles and permission by the given names' list.

public abstract getByNames( string[] $names ): array
$names string[]

List of role and/or permission names.

return array

Array of role and permission instances indexed by their corresponding names.

                public function getByNames(array $names): array;

            
getDirectChildren() public abstract method

Returns direct child permissions and/or roles.

public abstract getDirectChildren( string $name ): array
$name string

The parent name.

return array

The child permissions and/or roles.

                public function getDirectChildren(string $name): array;

            
getHierarchy() public abstract method

Returns the parents tree for a single item which additionally contains children for each parent (only among the found items). The base item is included too, its children list is always empty.

public abstract getHierarchy( string $name ): array
$name string

The child name.

return array

A mapping between parent names and according items with all their children (references to other parents found).

                public function getHierarchy(string $name): array;

            
getParents() public abstract method

Returns the parent permissions and/or roles.

public abstract getParents( string $name ): array
$name string

The child name.

return array

The parent permissions and/or roles.

                public function getParents(string $name): array;

            
getPermission() public abstract method

Returns the named permission.

public abstract getPermission( string $name ): Yiisoft\Rbac\Permission|null
$name string

The permission name.

return Yiisoft\Rbac\Permission|null

The permission corresponding to the specified name. null is returned if there is no such permission.

                public function getPermission(string $name): ?Permission;

            
getPermissions() public abstract method

Returns all permissions in the system.

public abstract getPermissions( ): Yiisoft\Rbac\Permission[]
return Yiisoft\Rbac\Permission[]

Array of permission instances indexed by permission names.

                public function getPermissions(): array;

            
getPermissionsByNames() public abstract method

Returns permissions by the given names' list.

public abstract getPermissionsByNames( string[] $names ): Yiisoft\Rbac\Permission[]
$names string[]

List of permission names.

return Yiisoft\Rbac\Permission[]

Array of permission instances indexed by permission names.

                public function getPermissionsByNames(array $names): array;

            
getRole() public abstract method

Returns the named role.

public abstract getRole( string $name ): Yiisoft\Rbac\Role|null
$name string

The role name.

return Yiisoft\Rbac\Role|null

The role corresponding to the specified name. null is returned if no such role.

                public function getRole(string $name): ?Role;

            
getRoles() public abstract method

Returns all roles in the system.

public abstract getRoles( ): Yiisoft\Rbac\Role[]
return Yiisoft\Rbac\Role[]

Array of role instances indexed by role names.

                public function getRoles(): array;

            
getRolesByNames() public abstract method

Returns roles by the given names' list.

public abstract getRolesByNames( string[] $names ): Yiisoft\Rbac\Role[]
$names string[]

List of role names.

return Yiisoft\Rbac\Role[]

Array of role instances indexed by role names.

                public function getRolesByNames(array $names): array;

            
hasChild() public abstract method

Returns whether selected parent has a child with a given name.

public abstract hasChild( string $parentName, string $childName ): boolean
$parentName string

The parent name.

$childName string

The child name.

return boolean

Whether selected parent has a child with a given name.

                public function hasChild(string $parentName, string $childName): bool;

            
hasChildren() public abstract method

Returns whether named parent has children.

public abstract hasChildren( string $name ): boolean
$name string

The parent name.

return boolean

Whether named parent has children.

                public function hasChildren(string $name): bool;

            
hasDirectChild() public abstract method

Returns whether selected parent has a direct child with a given name.

public abstract hasDirectChild( string $parentName, string $childName ): boolean
$parentName string

The parent name.

$childName string

The child name.

return boolean

Whether selected parent has a direct child with a given name.

                public function hasDirectChild(string $parentName, string $childName): bool;

            
remove() public abstract method

Removes a role or permission from the RBAC system.

public abstract remove( string $name ): void
$name string

Name of a role or a permission to remove.

                public function remove(string $name): void;

            
removeChild() public abstract method

Removes a child from its parent.

Note, the child role or permission is not deleted. Only the parent-child relationship is removed.

public abstract removeChild( string $parentName, string $childName ): void
$parentName string

Name of the parent to remove the child from.

$childName string

Name of the child to remove.

                public function removeChild(string $parentName, string $childName): void;

            
removeChildren() public abstract method

Removed all children form their parent.

Note, the children roles or permissions are not deleted. Only the parent-child relationships are removed.

public abstract removeChildren( string $parentName ): void
$parentName string

Name of the parent to remove children from.

                public function removeChildren(string $parentName): void;

            
roleExists() public abstract method

Whether a named role exists.

public abstract roleExists( string $name ): boolean
$name string

The role name.

return boolean

Whether a named role exists.

                public function roleExists(string $name): bool;

            
update() public abstract method

Updates the specified role or permission in the system.

public abstract update( string $name, Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role $item ): void
$name string

The old name of the role or permission.

$item Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role

Modified role or permission.

                public function update(string $name, Permission|Role $item): void;