0 follower

Interface Yiisoft\Rbac\AssignmentsStorageInterface

Implemented byYiisoft\Rbac\SimpleAssignmentsStorage

AssignmentsStorageInterface represents a storage for assignment of RBAC items (a role or a permission) to a user used in {@see Manager}.

Public Methods

Hide inherited methods

Method Description Defined By
add() Adds assignment to the storage. Yiisoft\Rbac\AssignmentsStorageInterface
clear() Removes all role and permission assignments. Yiisoft\Rbac\AssignmentsStorageInterface
exists() Whether assignment with a given item name and user id pair exists. Yiisoft\Rbac\AssignmentsStorageInterface
filterUserItemNames() Filters item names leaving only the ones that are assigned to specific user. Yiisoft\Rbac\AssignmentsStorageInterface
get() Returns role or permission assignment for the specified item name that belongs to user with the specified ID. Yiisoft\Rbac\AssignmentsStorageInterface
getAll() Returns all role and permission assignment information. Yiisoft\Rbac\AssignmentsStorageInterface
getByItemNames() Returns all role or permission assignment information by the specified item names' list. Yiisoft\Rbac\AssignmentsStorageInterface
getByUserId() Returns all role or permission assignment information for the specified user. Yiisoft\Rbac\AssignmentsStorageInterface
hasItem() Returns whether there is assignment for a named role or permission. Yiisoft\Rbac\AssignmentsStorageInterface
remove() Removes assignment of a role or a permission to the user with ID specified. Yiisoft\Rbac\AssignmentsStorageInterface
removeByItemName() Removes all assignments for role or permission. Yiisoft\Rbac\AssignmentsStorageInterface
removeByUserId() Removes all role or permission assignments for a user with ID specified. Yiisoft\Rbac\AssignmentsStorageInterface
renameItem() Change the name of an item in assignments. Yiisoft\Rbac\AssignmentsStorageInterface
userHasItem() Whether at least one item from the given list is assigned to the user. Yiisoft\Rbac\AssignmentsStorageInterface

Method Details

Hide inherited methods

add() public abstract method

Adds assignment to the storage.

public abstract void add ( Yiisoft\Rbac\Assignment $assignment )
$assignment Yiisoft\Rbac\Assignment

Assignment instance.

                public function add(Assignment $assignment): void;

            
clear() public abstract method

Removes all role and permission assignments.

public abstract void clear ( )

                public function clear(): void;

            
exists() public abstract method

Whether assignment with a given item name and user id pair exists.

public abstract boolean exists ( string $itemName, string $userId )
$itemName string

Item name.

$userId string

User id.

return boolean

Whether assignment exists.

                public function exists(string $itemName, string $userId): bool;

            
filterUserItemNames() public abstract method

Filters item names leaving only the ones that are assigned to specific user.

public abstract string[] filterUserItemNames ( string $userId, string[] $itemNames )
$userId string

User id.

$itemNames string[]

List of item names.

return string[]

Filtered item names.

                public function filterUserItemNames(string $userId, array $itemNames): array;

            
get() public abstract method

Returns role or permission assignment for the specified item name that belongs to user with the specified ID.

public abstract Yiisoft\Rbac\Assignment|null get ( string $itemName, string $userId )
$itemName string

Item name.

$userId string

The user ID.

return Yiisoft\Rbac\Assignment|null

Assignment or null if there is no role or permission assigned to the user.

                public function get(string $itemName, string $userId): ?Assignment;

            
getAll() public abstract method

Returns all role and permission assignment information.

public abstract array getAll ( )

                public function getAll(): array;

            
getByItemNames() public abstract method

Returns all role or permission assignment information by the specified item names' list.

public abstract Yiisoft\Rbac\Assignment[] getByItemNames ( string[] $itemNames )
$itemNames string[]

List of item names.

return Yiisoft\Rbac\Assignment[]

The assignments. An empty array will be returned if there are no users assigned to these item names.

                public function getByItemNames(array $itemNames): array;

            
getByUserId() public abstract method

Returns all role or permission assignment information for the specified user.

public abstract Yiisoft\Rbac\Assignment[] getByUserId ( string $userId )
$userId string

The user ID.

return Yiisoft\Rbac\Assignment[]

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

                public function getByUserId(string $userId): array;

            
hasItem() public abstract method

Returns whether there is assignment for a named role or permission.

public abstract boolean hasItem ( string $name )
$name string

Name of the role or the permission.

return boolean

Whether there is assignment.

                public function hasItem(string $name): bool;

            
remove() public abstract method

Removes assignment of a role or a permission to the user with ID specified.

public abstract void remove ( string $itemName, string $userId )
$itemName string

Name of a role or permission to remove assignment from.

$userId string

The user ID.

                public function remove(string $itemName, string $userId): void;

            
removeByItemName() public abstract method

Removes all assignments for role or permission.

public abstract void removeByItemName ( string $itemName )
$itemName string

Name of a role or permission to remove.

                public function removeByItemName(string $itemName): void;

            
removeByUserId() public abstract method

Removes all role or permission assignments for a user with ID specified.

public abstract void removeByUserId ( string $userId )
$userId string

The user ID.

                public function removeByUserId(string $userId): void;

            
renameItem() public abstract method

Change the name of an item in assignments.

public abstract void renameItem ( string $oldName, string $newName )
$oldName string

Old name of the role or the permission.

$newName string

New name of the role or permission.

                public function renameItem(string $oldName, string $newName): void;

            
userHasItem() public abstract method

Whether at least one item from the given list is assigned to the user.

public abstract boolean userHasItem ( string $userId, string[] $itemNames )
$userId string

User id.

$itemNames string[]

List of item names.

return boolean

Whether at least one item from the given list is assigned to the user.

                public function userHasItem(string $userId, array $itemNames): bool;