Interface Yiisoft\Rbac\ItemsStorageInterface
| Implemented by | Yiisoft\Rbac\SimpleItemsStorage |
|---|
A storage for RBAC roles and permissions used in {@see Manager}.
Public 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
Adds the role or the permission to RBAC system.
| public abstract void add ( Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role $item ) | ||
| $item | Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role |
The role or the permission to add. |
public function add(Permission|Role $item): void;
Adds a role or a permission as a child of another role or permission.
| public abstract void addChild ( string $parentName, string $childName ) | ||
| $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;
Removes all permissions.
All parent child relations will be adjusted accordingly.
| public abstract void clearPermissions ( ) |
public function clearPermissions(): void;
Removes all roles.
All parent child relations will be adjusted accordingly.
| public abstract void clearRoles ( ) |
public function clearRoles(): void;
Whether a named role or permission exists.
| public abstract boolean exists ( string $name ) | ||
| $name | string |
The role or the permission name. |
| return | boolean |
Whether a named role or permission exists. |
|---|---|---|
public function exists(string $name): bool;
Returns the named role or permission.
| public abstract Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role|null get ( string $name ) | ||
| $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. |
|---|---|---|
public function get(string $name): Permission|Role|null;
Returns all roles and permissions in the system.
| public abstract array getAll ( ) | ||
| return | array |
All roles and permissions in the system. |
|---|---|---|
public function getAll(): array;
Returns all child permissions.
| public abstract Yiisoft\Rbac\Permission[] getAllChildPermissions ( string|string[] $names ) | ||
| $names | string|string[] |
The parent name / names. |
| return | Yiisoft\Rbac\Permission[] |
The child permissions. |
|---|---|---|
public function getAllChildPermissions(string|array $names): array;
Returns all child roles.
| public abstract Yiisoft\Rbac\Role[] getAllChildRoles ( string|string[] $names ) | ||
| $names | string|string[] |
The parent name / names. |
| return | Yiisoft\Rbac\Role[] |
The child roles. |
|---|---|---|
public function getAllChildRoles(string|array $names): array;
Returns all child permissions and/or roles.
| public abstract array getAllChildren ( string|string[] $names ) | ||
| $names | string|string[] |
The parent name / names. |
| return | array |
The child permissions and/or roles. |
|---|---|---|
public function getAllChildren(string|array $names): array;
Returns roles and permission by the given names' list.
| public abstract array getByNames ( string[] $names ) | ||
| $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;
Returns direct child permissions and/or roles.
| public abstract array getDirectChildren ( string $name ) | ||
| $name | string |
The parent name. |
| return | array |
The child permissions and/or roles. |
|---|---|---|
public function getDirectChildren(string $name): array;
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 array getHierarchy ( string $name ) | ||
| $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;
Returns the parent permissions and/or roles.
| public abstract array getParents ( string $name ) | ||
| $name | string |
The child name. |
| return | array |
The parent permissions and/or roles. |
|---|---|---|
public function getParents(string $name): array;
Returns the named permission.
| public abstract Yiisoft\Rbac\Permission|null getPermission ( string $name ) | ||
| $name | string |
The permission name. |
| return | Yiisoft\Rbac\Permission|null |
The permission corresponding to the specified name. |
|---|---|---|
public function getPermission(string $name): ?Permission;
Returns all permissions in the system.
| public abstract Yiisoft\Rbac\Permission[] getPermissions ( ) | ||
| return | Yiisoft\Rbac\Permission[] |
Array of permission instances indexed by permission names. |
|---|---|---|
public function getPermissions(): array;
Returns permissions by the given names' list.
| public abstract Yiisoft\Rbac\Permission[] getPermissionsByNames ( string[] $names ) | ||
| $names | string[] |
List of permission names. |
| return | Yiisoft\Rbac\Permission[] |
Array of permission instances indexed by permission names. |
|---|---|---|
public function getPermissionsByNames(array $names): array;
Returns the named role.
| public abstract Yiisoft\Rbac\Role|null getRole ( string $name ) | ||
| $name | string |
The role name. |
| return | Yiisoft\Rbac\Role|null |
The role corresponding to the specified name. |
|---|---|---|
public function getRole(string $name): ?Role;
Returns all roles in the system.
| public abstract Yiisoft\Rbac\Role[] getRoles ( ) | ||
| return | Yiisoft\Rbac\Role[] |
Array of role instances indexed by role names. |
|---|---|---|
public function getRoles(): array;
Returns roles by the given names' list.
| public abstract Yiisoft\Rbac\Role[] getRolesByNames ( string[] $names ) | ||
| $names | string[] |
List of role names. |
| return | Yiisoft\Rbac\Role[] |
Array of role instances indexed by role names. |
|---|---|---|
public function getRolesByNames(array $names): array;
Returns whether selected parent has a child with a given name.
| public abstract boolean hasChild ( string $parentName, string $childName ) | ||
| $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;
Returns whether named parent has children.
| public abstract boolean hasChildren ( string $name ) | ||
| $name | string |
The parent name. |
| return | boolean |
Whether named parent has children. |
|---|---|---|
public function hasChildren(string $name): bool;
Returns whether selected parent has a direct child with a given name.
| public abstract boolean hasDirectChild ( string $parentName, string $childName ) | ||
| $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;
Removes a role or permission from the RBAC system.
| public abstract void remove ( string $name ) | ||
| $name | string |
Name of a role or a permission to remove. |
public function remove(string $name): void;
Removes a child from its parent.
Note, the child role or permission is not deleted. Only the parent-child relationship is removed.
| public abstract void removeChild ( string $parentName, string $childName ) | ||
| $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;
Removed all children form their parent.
Note, the children roles or permissions are not deleted. Only the parent-child relationships are removed.
| public abstract void removeChildren ( string $parentName ) | ||
| $parentName | string |
Name of the parent to remove children from. |
public function removeChildren(string $parentName): void;
Whether a named role exists.
| public abstract boolean roleExists ( string $name ) | ||
| $name | string |
The role name. |
| return | boolean |
Whether a named role exists. |
|---|---|---|
public function roleExists(string $name): bool;
Updates the specified role or permission in the system.
| public abstract void update ( string $name, Yiisoft\Rbac\Permission|Yiisoft\Rbac\Role $item ) | ||
| $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;
Signup or Login in order to comment.