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\Settings;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Uxmp\Core\Api\AbstractApiApplication;
use Uxmp\Core\Api\Lib\Exception\AccessViolation;
use Uxmp\Core\Api\Lib\Middleware\SessionValidatorMiddleware;
use Uxmp\Core\Component\User\PrivilegeCheckerInterface;
/**
* User list retrieval
*/
abstract class AbstractSettingsApplication extends AbstractApiApplication
{
public function __construct(
private readonly PrivilegeCheckerInterface $privilegeChecker
) {
}
* @param array<string, scalar> $args
*
* @throws AccessViolation
protected function run(
ServerRequestInterface $request,
ResponseInterface $response,
array $args
): ResponseInterface {
$user = $request->getAttribute(SessionValidatorMiddleware::USER);
if (!$this->privilegeChecker->isAdmin($user)) {
throw new AccessViolation();
return $this->asJson(
$response,
$this->serve($request, $args)
);
* @return array<mixed>
* }
abstract protected function serve(
): array;