MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP Thu May 7 23:17:13 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/help.cafsindia.com/vendor/uvdesk/api-bundle/API/Me.php
<?php

namespace Webkul\UVDesk\ApiBundle\API;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Webkul\UVDesk\CoreFrameworkBundle\Entity\User;
use Webkul\UVDesk\CoreFrameworkBundle\Services\UVDeskService as Uvdesk;

class Me extends AbstractController
{
    public function loadCurrentAgentDetails(Request $request, Uvdesk $uvdesk)
    {
        $user = $this->getUser();
        $userInstance = $user->getCurrentInstance();

        $thumbnail = $uvdesk->generateCompleteLocalResourcePathUri($userInstance->getProfileImagePath() ?? $this->getParameter('assets_default_agent_profile_image_path'));
        $scopes = $uvdesk->getAvailableUserAccessScopes($user, $userInstance);

        return new JsonResponse([
            'success' => true, 
            'me' => [
                'id' => $user->getId(), 
                'email' => $user->getEmail(), 
                'name' => trim(implode(' ', array_values(array_filter([$user->getFirstName(), $user->getLastName()])))), 
                'firstName' => $user->getFirstName(), 
                'lastName' => $user->getLastName(), 
                'isEnabled' => $user->getIsEnabled(), 
                'thumbnail' => $thumbnail, 
            ], 
            'scopes' => $scopes,
        ]);
    }
}