migration symfo
This commit is contained in:
@@ -2,23 +2,18 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Repository\ProjectRepository;
|
||||
use App\Service\EtherpadService;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class HomeController extends AbstractController
|
||||
{
|
||||
#[Route('/', name: 'app_home')]
|
||||
public function home(Request $request): Response
|
||||
public function home(ProjectRepository $projectRepository): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
if (!$user instanceof User) {
|
||||
throw new AccessDeniedException('Vous n\'avez pas accès à cette ressource.');
|
||||
}
|
||||
$projects = $user->getProjects();
|
||||
$projects = $projectRepository->findAll();
|
||||
|
||||
return $this->render('home/home.html.twig', [
|
||||
'usemenu' => true,
|
||||
@@ -35,4 +30,19 @@ class HomeController extends AbstractController
|
||||
'usesidebar' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/user/etherpad/{id}', name: 'app_ehterpad')]
|
||||
public function etherpad(string $id, EtherpadService $etherpadService): Response
|
||||
{
|
||||
$padAccess = $etherpadService->preparePadAccess($this->getUser(), $id);
|
||||
dump(vars: $padAccess);
|
||||
|
||||
$response = $this->render('etherpad/show.html.twig', [
|
||||
'iframeUrl' => $padAccess['iframeUrl'],
|
||||
]);
|
||||
|
||||
$response->headers->setCookie($padAccess['cookie']);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user