mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 23:57:49 +08:00
39 lines
770 B
PHP
39 lines
770 B
PHP
<?php
|
|
|
|
namespace App\Annotation;
|
|
|
|
use Attribute;
|
|
use Hyperf\Di\Annotation\AbstractAnnotation;
|
|
|
|
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
|
class Permission extends AbstractAnnotation
|
|
{
|
|
public const string OPERATION_AND = 'and';
|
|
|
|
public const string OPERATION_OR = 'or';
|
|
|
|
/**
|
|
* @param array|string $code
|
|
* @param string $operation
|
|
*/
|
|
public function __construct(
|
|
protected array|string $code,
|
|
protected string $operation = self::OPERATION_AND
|
|
) {}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getCode(): array
|
|
{
|
|
return (array) $this->code;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getOperation(): string
|
|
{
|
|
return $this->operation;
|
|
}
|
|
} |