|
|
@@ -2,6 +2,7 @@ |
|
|
namespace App\Controller; |
|
|
namespace App\Controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Contao\BackendUser; |
|
|
use Doctrine\DBAL\Connection; |
|
|
use Doctrine\DBAL\Connection; |
|
|
use Onurb\Bundle\ExcelBundle\Factory\ExcelFactory; |
|
|
use Onurb\Bundle\ExcelBundle\Factory\ExcelFactory; |
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
|
@@ -13,7 +14,6 @@ use Symfony\Component\HttpKernel\KernelInterface; |
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
|
use Twig\Environment as TwigEnvironment; |
|
|
use Twig\Environment as TwigEnvironment; |
|
|
use Terminal42\ServiceAnnotationBundle\Annotation\ServiceTag; |
|
|
use Terminal42\ServiceAnnotationBundle\Annotation\ServiceTag; |
|
|
use function Ramsey\Uuid\v1; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Route("/contao/key-data", |
|
|
* @Route("/contao/key-data", |
|
|
@@ -36,6 +36,10 @@ class BackendController extends AbstractController |
|
|
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/jquery/js/jquery.js'; |
|
|
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/jquery/js/jquery.js'; |
|
|
$this->twig = $twig; |
|
|
$this->twig = $twig; |
|
|
$this->kernel = $kernel; |
|
|
$this->kernel = $kernel; |
|
|
|
|
|
|
|
|
|
|
|
if (!BackendController::hasRightsToImport()) { |
|
|
|
|
|
throw new \Exception('invalid rights'); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@@ -161,4 +165,10 @@ class BackendController extends AbstractController |
|
|
{ |
|
|
{ |
|
|
return $request->cookies->get($this->kernel->getEnvironment() === 'dev' ? 'csrf_contao_csrf_token' : 'csrf_https-contao_csrf_token'); |
|
|
return $request->cookies->get($this->kernel->getEnvironment() === 'dev' ? 'csrf_contao_csrf_token' : 'csrf_https-contao_csrf_token'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static function hasRightsToImport() |
|
|
|
|
|
{ |
|
|
|
|
|
$objUser = BackendUser::getInstance(); |
|
|
|
|
|
return $objUser->isAdmin || in_array(2, $objUser->groups, false); |
|
|
|
|
|
} |
|
|
} |
|
|
} |