Abstract Class Yiisoft\Rbac\Item
| Inheritance | Yiisoft\Rbac\Item |
|---|---|
| Subclasses | Yiisoft\Rbac\Permission, Yiisoft\Rbac\Role |
Items are RBAC hierarchy entities that could be assigned to the user.
Both roles and permissions are items.
Public Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| TYPE_PERMISSION | 'permission' | Yiisoft\Rbac\Item | |
| TYPE_ROLE | 'role' | Yiisoft\Rbac\Item |
Method Details
| public mixed __construct ( string $name ) | ||
| $name | string |
The name of the item. This must be globally unique. |
final public function __construct(private string $name) {}
| 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(),
];
}
| public integer|null getCreatedAt ( ) |
final public function getCreatedAt(): ?int
{
return $this->createdAt;
}
| public string getDescription ( ) |
final public function getDescription(): string
{
return $this->description;
}
| public string getName ( ) | ||
| return | string |
Authorization item name. |
|---|---|---|
final public function getName(): string
{
return $this->name;
}
| public string|null getRuleName ( ) |
final public function getRuleName(): ?string
{
return $this->ruleName;
}
| public abstract string getType ( ) | ||
| return | string |
Type of the item. |
|---|---|---|
abstract public function getType(): string;
| public integer|null getUpdatedAt ( ) |
final public function getUpdatedAt(): ?int
{
return $this->updatedAt;
}
| public boolean hasCreatedAt ( ) |
final public function hasCreatedAt(): bool
{
return $this->createdAt !== null;
}
| public boolean hasUpdatedAt ( ) |
final public function hasUpdatedAt(): bool
{
return $this->updatedAt !== null;
}
| public Yiisoft\Rbac\Item withCreatedAt ( integer $createdAt ) | ||
| $createdAt | integer | |
final public function withCreatedAt(int $createdAt): self
{
$new = clone $this;
$new->createdAt = $createdAt;
return $new;
}
| public Yiisoft\Rbac\Item withDescription ( string $description ) | ||
| $description | string | |
final public function withDescription(string $description): self
{
$new = clone $this;
$new->description = $description;
return $new;
}
| public Yiisoft\Rbac\Item withName ( string $name ) | ||
| $name | string | |
final public function withName(string $name): self
{
$new = clone $this;
$new->name = $name;
return $new;
}
| 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;
}
| public Yiisoft\Rbac\Item withUpdatedAt ( integer $updatedAt ) | ||
| $updatedAt | integer | |
final public function withUpdatedAt(int $updatedAt): self
{
$new = clone $this;
$new->updatedAt = $updatedAt;
return $new;
}
Signup or Login in order to comment.