39 lines
904 B
PHP
39 lines
904 B
PHP
<?php
|
|
/**
|
|
* This service file is part of item.
|
|
*
|
|
* @author ctexthuang
|
|
* @contact ctexthuang@qq.com
|
|
* @web_site https://ctexthuang.com
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Service\Test\Composite\Permission;
|
|
|
|
use App\Interface\Test\Composite\PermissionComponentInterface;
|
|
|
|
class BasicPermissionService
|
|
{
|
|
/**
|
|
* @var PermissionComponentInterface
|
|
*/
|
|
private PermissionComponentInterface $rootPermissionComponent;
|
|
|
|
/**
|
|
* @param PermissionComponentInterface $rootPermissionComponent
|
|
*/
|
|
public function __construct(PermissionComponentInterface $rootPermissionComponent)
|
|
{
|
|
$this->rootPermissionComponent = $rootPermissionComponent;
|
|
}
|
|
|
|
/**
|
|
* @param string $permission
|
|
* @return bool
|
|
*/
|
|
public function hasPermission(string $permission): bool
|
|
{
|
|
return $this->rootPermissionComponent->check($permission);
|
|
}
|
|
} |