<?php
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/
namespace Pimcore\Bundle\AdminBundle\Controller;
use Pimcore\Controller\Traits\JsonHelperTrait;
use Pimcore\Controller\UserAwareController;
use Pimcore\Model\User;
use Pimcore\Security\User\User as UserProxy;
use Symfony\Component\HttpFoundation\JsonResponse;
/**
* @internal
*/
abstract class AdminAbstractController extends UserAwareController
{
use JsonHelperTrait;
/**
* Returns a JsonResponse that uses the admin serializer
*/
protected function adminJson(mixed $data, int $status = 200, array $headers = [], array $context = [], bool $useAdminSerializer = true): JsonResponse
{
return $this->jsonResponse($data, $status, $headers, $context, $useAdminSerializer);
}
/**
* Get user from user proxy object which is registered on security component
*/
protected function getAdminUser(bool $proxyUser = false): UserProxy|User|null
{
return $this->getPimcoreUser($proxyUser);
}
}