Cookie consent action (xhr only).

@param Request $request

@return \Symfony\Component\HttpFoundation\Response
439976
public function cookieConsentAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

        $enabled = $this
            ->container
            ->getParameter('ekyna_cms.page.config')['cookie_consent']['enable'];

        if (!$enabled) {
            throw new NotFoundHttpException();
        }

        $response = $this->render('@EkynaCms/Cms/Cookie/response.xml.twig');

        $response->headers->add(['Content-Type' => 'application/xml']);

        return $response->setPrivate();
    }
1287042
protected function cancelCookie(Request $request)
    {
        if (null !== $this->logger) {
            $this->logger->debug('Clearing remember-me cookie.', ['name' => $this->options['name']]);
        }

        $request->attributes->set(self::COOKIE_ATTR_NAME, new Cookie($this->options['name'], null, 1, $this->options['path'], $this->options['domain'], $this->options['secure'] ?? $request->isSecure(), $this->options['httponly'], false, $this->options['samesite'] ?? null));
    }
874128
protected function doRequest(Request $request)
    {

        $this->client->send($request, $response = new Response());

        return $response;
    }
479907
public function store(Request $request)
    {
        $this->validate($request, ['name' => 'required']);

        Permission::create($request->all());

        return redirect('admin/permissions')->with('flash_message', 'Permission added!');
    }
681083
public function usersAction(Request $request)
    {
        $query = $request->get('query');
        $limit = $request->get('limit', 20);
        $offset = $request->get('start', 0);

        $userProvider = $this->get('phlexible_access_control.user_security_provider');

        $data = $userProvider->getAll($query, $limit, $offset);

        return new JsonResponse($data);
    }
559881
public function createAction(Request $request)
    {
        $newTag = new Tag();
        $newTagForm = $this->createForm(new TagType(),$newTag);

        $newTagForm->handleRequest($request);

        if($newTagForm->isValid())
        {
            $em = $this->getDoctrine()->getManager();
            $em->persist($newTag);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('tag'));
    }
1013528
public function deleteAction(Request $request)
    {
        if ($this->submitForm($this->buildForm(CsrfProtectionType::class), $request)->isValid()) {
            try {
                $this->getDomainManager()->delete($this->find('delete'));
            } catch (DomainException $e) {
                $this->processException($e);
            }
        }

        return $this->processAction('delete');
    }
214392
public function handle(Request $request)
    {
        $response = new Response();
        $response = $this->executePassiveActions($request, $response);
        $response = $this->executeAction($request, $response);

        if ($response->isClientError() || $response->isServerError()) {
            return $this->handleError($request, $response);
        }

        return $response;
    }
650695
public function createAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ROLE_ADMIN');

        $domain = new Domain();

        $form = $this->createForm(DomainType::class, $domain);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($domain);
            $em->flush();

            $this->addFlash('success', 'Domaim has been created successfully');

            return $this->redirectToRoute('opifer_cms_domain_edit', ['id' => $domain->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Domain:create.html.twig', [
            'domain' => $domain,
            'form' => $form->createView()
        ]);
    }
986719
public function run(Request $request) {
		$page = $this->getServiceContainer()->getKernel()->getApplication()->getPage();
		$page->setTitle($this->getServiceContainer()->getTranslator()->trans('sessions'));

		if ($request->isMethod('POST')) {
			$post = $request->request;
			if ($post->has('token')) {
				SessionQuery::create()->findOneByToken($post->get('token'))->delete();
				$service = $this->getServiceContainer();
				$accountUrl = $service->getPreferenceLoader()->getSystemPreferences()->getAccountUrl();
				$translator = $service->getTranslator();
				$url = sprintf('%s%s/%s',
					$accountUrl,
					$translator->trans('slug.settings'),
					$translator->trans('slug.settings.sessions')
				);
				return new RedirectResponse($url);
			}
		}

		return $this->responder->run($request);
	}
960992
public function handle(Request $request)
    {
        $this->currentUri = $request->fullUrl();

        $this->response = $this->app->prepareResponse($this->app->handle($request));

        return $this;
    }
1279098
public function sendRequest(Request $request)
    {
        $response = $this->httpClient->send($request);

        $this->checkErrorResponse($response);

        return $response;
    }
191309
protected function sendLockoutResponse(Request $request)
    {
        $seconds = $this->limiter()->availableIn(
            $this->throttleKey($request)
        );

        $message = Lang::get('auth.throttle', ['seconds' => $seconds]);

        $errors = [$this->username() => $message];

        if ($request->expectsJson()) {
            return api([], 422, $message);
        }

        return redirect()->back()
            ->withInput($request->only($this->username(), 'remember'))
            ->withErrors($errors);
    }
830939
public function setRequest(Request $request)
    {
        // reset the current state
        $this->reset();

        // retrieve a new session from the app
        $this->session = $this->app->make('session');

        return parent::setRequest($request);
    }
496768
private function authCookie(Request $request) {
		if ($request->cookies->has(self::COOKIE_TOKEN_NAME)) {
			$token = $request->cookies->get(self::COOKIE_TOKEN_NAME);
			return $this->authToken($token);
		}
		return null;
	}
1024264
public function permissionsAction(Request $request)
    {
        $objectType = $request->get('objectType');

        $permissionRegistry = $this->get('phlexible_access_control.permission_registry');
        $permissions = array();
        foreach ($permissionRegistry->get($objectType)->all() as $permission) {
            $permissions[] = array(
                'name' => $permission->getName(),
                'bit' => $permission->getBit(),
                'iconCls' => 'null',
            );
        }

        return new JsonResponse(array('permissions' => $permissions));
    }
420344
public function loginAction(Request $request): Response
    {
        $session = $request->getSession();

        # https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/blob/master/Resources/doc/a_note_about_security.md
        if ($request->attributes->has('_fos_oauth_server_authorize_enabled') && $session->has('_security.target_path')) {
            if (false !== strpos($session->get('_security.target_path'), $this->router->generate('fos_oauth_server_authorize'))) {
                $session->set('_fos_oauth_server.ensure_logout', true);
            }
        }

        $alreadyLoggedInRedirectRoute = $request->attributes->get('_sylius')['logged_in_route'] ?? null;

        if ($alreadyLoggedInRedirectRoute && $this->authorizationChecker->isGranted('IS_AUTHENTICATED_FULLY')) {
            return new RedirectResponse($this->router->generate($alreadyLoggedInRedirectRoute));
        }

        $lastError = $this->authenticationUtils->getLastAuthenticationError();
        $lastUsername = $this->authenticationUtils->getLastUsername();
        $options = $request->attributes->get('_sylius');
        $template = $options['template'] ?? '@chang/security/login.html.twig';
        $formType = $options['form'] ?? SecurityLoginType::class;
        $form = $this->formFactory->createNamed('', $formType);

        return $this->templateEngine->renderResponse($template, [
            'form' => $form->createView(),
            'last_username' => $lastUsername,
            'last_error' => $lastError,
            'login_check_route' => $request->attributes->get('_sylius')['login_check_route'] ?? null,
            'csrf_parameter' => $request->attributes->get('_sylius')['csrf_parameter'] ?? null,
            'csrf_token_id' => $request->attributes->get('_sylius')['csrf_token_id'] ?? null,
        ]);
    }