2021-10-22 13:39:22 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Storage\Session;
|
|
|
|
|
|
|
|
use Taxus\{ Privilege, Taxus, PermissionGrantInterface, DefaultPermissionGrant };
|
|
|
|
|
|
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
|
|
|
2024-05-20 18:56:07 +00:00
|
|
|
use function DI\{ create, get, add };
|
2023-11-03 16:28:31 +00:00
|
|
|
|
2021-10-22 13:39:22 +00:00
|
|
|
return [
|
|
|
|
Taxus::class => function ($c) {
|
2024-05-20 18:56:07 +00:00
|
|
|
$taxus = new Taxus( ... $c->get('taxus.gates') );
|
|
|
|
|
|
|
|
$list = [];
|
|
|
|
|
|
|
|
foreach($c->get(Lean\Lean::class)->getTaxusPrivileges() as $key => $privilege) {
|
|
|
|
foreach($privilege as $name => $description) {
|
|
|
|
$list[] = [ new Privilege($name, $description), $key ];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$taxus->add(... $list);
|
|
|
|
|
|
|
|
return $taxus;
|
2021-10-22 13:39:22 +00:00
|
|
|
},
|
|
|
|
|
2024-05-20 18:56:07 +00:00
|
|
|
'taxus.gates' => add([
|
|
|
|
get(PermissionGrantInterface::class),
|
|
|
|
]),
|
|
|
|
|
2023-09-20 18:42:13 +00:00
|
|
|
PermissionGrantInterface::class => create(%NAMESPACE%\PrivilegeGrantAccess::class)->constructor(get(ServerRequestInterface::class), get(Session::class)),
|
2021-10-22 13:39:22 +00:00
|
|
|
];
|