for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Uxmp\Core\Api\User;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Uxmp\Core\Api\AbstractApiApplication;
use Uxmp\Core\Api\Lib\Middleware\SessionValidatorMiddleware;
use Uxmp\Core\Component\User\PrivilegeCheckerInterface;
use Uxmp\Core\Orm\Model\UserInterface;
/**
* Delivers the user's acl
*/
final class UserAclRetrieveApplication extends AbstractApiApplication
{
public function __construct(
private readonly PrivilegeCheckerInterface $privilegeChecker,
) {
}
protected function run(
ServerRequestInterface $request,
ResponseInterface $response,
array $args
): ResponseInterface {
/** @var UserInterface $user */
$user = $request->getAttribute(SessionValidatorMiddleware::USER);
return $this->asJson(
$response,
$this->privilegeChecker->getAcl($user)
);