2023-11-16 03:26:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use function DI\autowire, DI\create, DI\get;
|
|
|
|
|
|
|
|
use Storage\Session;
|
|
|
|
|
|
|
|
use Taxus\{ Privilege, Taxus, PermissionGrantInterface, DefaultPermissionGrant };
|
|
|
|
|
|
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
|
|
|
|
|
|
return [
|
|
|
|
Taxus::class => function ($c) {
|
2023-11-16 04:25:56 +00:00
|
|
|
return ( new Taxus( $c->get(PermissionGrantInterface::class) ) )->add(
|
|
|
|
[ new Privilege("dev", "Is a developper of this application."), "is_dev" ],
|
|
|
|
[ new Privilege("admin", "Can manage mostly everything from this application."), "is_admin" ],
|
|
|
|
[ new Privilege("user", "Is an authenticated user."), "is_user" ],
|
|
|
|
[ new Privilege("anonymous", "Is an anonymous (unauthenticated) user."), "is_anonymous" ],
|
|
|
|
);
|
2023-11-16 03:26:59 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
PermissionGrantInterface::class => create(PermissionGrantInterface::class)->constructor(get(ServerRequestInterface::class), get(Session::class)),
|
|
|
|
];
|