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 mixed __construct ( string $name )
$name string

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

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

            
getAttributes() public method

public array getAttributes ( )
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 integer|null getCreatedAt ( )

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

            
getDescription() public method

public string getDescription ( )

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

            
getName() public method

public string getName ( )
return string

Authorization item name.

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

            
getRuleName() public method

public string|null getRuleName ( )

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

            
getType() public abstract method

public abstract string getType ( )
return string

Type of the item.

                abstract public function getType(): string;

            
getUpdatedAt() public method

public integer|null getUpdatedAt ( )

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

            
hasCreatedAt() public method

public boolean hasCreatedAt ( )

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

            
hasUpdatedAt() public method

public boolean hasUpdatedAt ( )

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

            
withCreatedAt() public method

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

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

            
withDescription() public method

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

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

            
withName() public method

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

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

            
withRuleName() public method

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

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

            
withUpdatedAt() public method

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

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