0 follower

Abstract Class Yiisoft\Rbac\Item

InheritanceYiisoft\Rbac\Item
SubclassesYiisoft\Rbac\Permission, Yiisoft\Rbac\Role

Items are RBAC hierarchy entities that could be assigned to the user.

Both roles and permissions are items.

Constants

Hide inherited constants

Constant Value Description Defined By
TYPE_PERMISSION 'permission' Yiisoft\Rbac\Item
TYPE_ROLE 'role' Yiisoft\Rbac\Item

Method Details

Hide inherited methods

__construct() public method

public __construct( string $name ): mixed
$name string

The name of the item. This must be globally unique.

                final public function __construct(private string $name) {}

            
getAttributes() public method

public getAttributes( ): array
return array

Attribute values indexed by corresponding names.

                final public function getAttributes(): array
{
    return [
        'name' => $this->getName(),
        'description' => $this->getDescription(),
        'rule_name' => $this->getRuleName(),
        'type' => $this->getType(),
        'updated_at' => $this->getUpdatedAt(),
        'created_at' => $this->getCreatedAt(),
    ];
}

            
getCreatedAt() public method

public getCreatedAt( ): integer|null

                final public function getCreatedAt(): ?int
{
    return $this->createdAt;
}

            
getDescription() public method

public getDescription( ): string

                final public function getDescription(): string
{
    return $this->description;
}

            
getName() public method

public getName( ): string
return string

Authorization item name.

                final public function getName(): string
{
    return $this->name;
}

            
getRuleName() public method

public getRuleName( ): string|null

                final public function getRuleName(): ?string
{
    return $this->ruleName;
}

            
getType() public abstract method

public abstract getType( ): string
return string

Type of the item.

                abstract public function getType(): string;

            
getUpdatedAt() public method

public getUpdatedAt( ): integer|null

                final public function getUpdatedAt(): ?int
{
    return $this->updatedAt;
}

            
hasCreatedAt() public method

public hasCreatedAt( ): boolean

                final public function hasCreatedAt(): bool
{
    return $this->createdAt !== null;
}

            
hasUpdatedAt() public method

public hasUpdatedAt( ): boolean

                final public function hasUpdatedAt(): bool
{
    return $this->updatedAt !== null;
}

            
withCreatedAt() public method

public withCreatedAt( integer $createdAt ): Yiisoft\Rbac\Item
$createdAt integer

                final public function withCreatedAt(int $createdAt): self
{
    $new = clone $this;
    $new->createdAt = $createdAt;
    return $new;
}

            
withDescription() public method

public withDescription( string $description ): Yiisoft\Rbac\Item
$description string

                final public function withDescription(string $description): self
{
    $new = clone $this;
    $new->description = $description;
    return $new;
}

            
withName() public method

public withName( string $name ): Yiisoft\Rbac\Item
$name string

                final public function withName(string $name): self
{
    $new = clone $this;
    $new->name = $name;
    return $new;
}

            
withRuleName() public method

public withRuleName( string|null $ruleName ): Yiisoft\Rbac\Item
$ruleName string|null

                final public function withRuleName(?string $ruleName): self
{
    $new = clone $this;
    $new->ruleName = $ruleName;
    return $new;
}

            
withUpdatedAt() public method

public withUpdatedAt( integer $updatedAt ): Yiisoft\Rbac\Item
$updatedAt integer

                final public function withUpdatedAt(int $updatedAt): self
{
    $new = clone $this;
    $new->updatedAt = $updatedAt;
    return $new;
}