mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 01:33:11 +08:00
Created specs for API key roles
This commit is contained in:
@@ -11,6 +11,7 @@ use Happyr\DoctrineSpecification\Spec;
|
||||
use Happyr\DoctrineSpecification\Specification\Specification;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Shlinkio\Shlink\Common\Entity\AbstractEntity;
|
||||
use Shlinkio\Shlink\Rest\ApiKey\Role;
|
||||
|
||||
class ApiKey extends AbstractEntity
|
||||
{
|
||||
@@ -69,6 +70,7 @@ class ApiKey extends AbstractEntity
|
||||
|
||||
public function spec(): Specification
|
||||
{
|
||||
return Spec::andX();
|
||||
$specs = $this->roles->map(fn (ApiKeyRole $role) => Role::toSpec($role));
|
||||
return Spec::andX(...$specs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,9 @@ class ApiKeyRole extends AbstractEntity
|
||||
{
|
||||
return $this->meta;
|
||||
}
|
||||
|
||||
public function apiKey(): ApiKey
|
||||
{
|
||||
return $this->apiKey;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user