mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 18:17:49 +08:00
feat : admin user finish
This commit is contained in:
39
app/Annotation/Permission.php
Normal file
39
app/Annotation/Permission.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,10 @@
|
||||
namespace App\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
||||
class ResponseFormat
|
||||
class ResponseFormat extends AbstractAnnotation
|
||||
{
|
||||
/**
|
||||
* @param string $format
|
||||
|
||||
Reference in New Issue
Block a user