Handle form entry of permission changes.

@param Request $request

@return bool
5455
public function bindRequest(Request $request)
    {
        $changes = $request->request->get('permission-hidden-fields');

        if (empty($changes)) {
            return true;
        }

        // Just apply the changes to the current node (non recursively)
        $this->applyAclChangeset($this->resource, $changes, false);

        // Apply recursively (on request)
        $applyRecursive = $request->request->get('applyRecursive');
        if ($applyRecursive) {
            // Serialize changes & store them in DB
            $user = $this->tokenStorage->getToken()->getUser();
            $this->createAclChangeSet($this->resource, $changes, $user);

            $cmd = 'php ' . $this->kernel->getRootDir() . '/../bin/console kuma:acl:apply';
            $cmd .= ' --env=' . $this->kernel->getEnvironment();

            $this->shellHelper->runInBackground($cmd);
        }

        return true;
    }
261183
public function update(Request $request, Permission $permission)
    {
        $this->authorize('update', Permission::class);

        if (str_replace(' ', '', $request->slug) != $request->slug) {
            return redirect()->back()->withInput()->with('error', __('laralum_permissions::general.slug_cannot_contain_spaces'));
        }
        $this->validate($request, [
            'name'        => 'required|max:255',
            'slug'        => 'required|max:255|unique:laralum_permissions,slug,'.$permission->id,
            'description' => 'required|max:500',
        ]);

        $permission->update($request->all());

        return redirect()->route('laralum::permissions.index')->with('success', __('laralum_permissions::general.permission_updated', ['id' => $permission->id]));
    }
361125
public function changePasswordAction(Request $request)
    {
        $user = $this->container->get('security.context')->getToken()->getUser();
        if (!is_object($user) || !$user instanceof UserInterface) {
            throw new AccessDeniedException('This user does not have access to this section.');
        }

        /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
        $dispatcher = $this->container->get('event_dispatcher');

        $event = new GetResponseUserEvent($user, $request);
        $dispatcher->dispatch(FOSUserEvents::CHANGE_PASSWORD_INITIALIZE, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
        $formFactory = $this->container->get('fos_user.change_password.form.factory');

        $form = $formFactory->createForm();
        $form->setData($user);

        $form->bind($request->query->get("params"));
        if ($form->isValid()) {
            /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */
            $userManager = $this->container->get('fos_user.user_manager');

            $event = new FormEvent($form, $request);
            $dispatcher->dispatch(FOSUserEvents::CHANGE_PASSWORD_SUCCESS, $event);

            $userManager->updateUser($user);

            if (null === $response = $event->getResponse()) {
                $response = new JsonResponse(array(
                	"success" => true
                ));
            }

            $dispatcher->dispatch(FOSUserEvents::CHANGE_PASSWORD_COMPLETED, new FilterUserResponseEvent($user, $request, $response));

            return $response;
        }
        $errors = array();
        foreach ($form->getErrors(true) as $error) {
        	$errors[] = $error->getMessage();
        }
		return new JsonResponse(array(
               	"success" => false,
				"errors" => $errors
        ));
    }
1216468
public function unlock(Request $request)
    {
        $key = $this->getCacheKey($request);

        if (isset($this->locks[$key])) {
            flock($this->locks[$key], LOCK_UN);
            fclose($this->locks[$key]);
            unset($this->locks[$key]);

            return true;
        }

        return false;
    }
1320463
public function handle(Request $request)
	{
		$response = $this->next($request);

		try
		{
			$this->app->get('arguments')->parse();
		}
		catch (UnsupportedCommandException $e)
		{
			$this->app->get('output')->error($e->getMessage());
		}
		catch (UnsupportedTaskException $e)
		{
			$this->app->get('output')->error($e->getMessage());
		}

		return $response;
	}
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;
    }
786528
public function handleRequest(Request $request) : void
    {
        $this->reset();
        $this->readSessionId($request);

        if ($this->isTimeToCollectGarbage()) {
            $this->collectGarbage();
        }

        $this->inRequest = true;
    }
576126
public function handleRequest(Request $request): void
    {
        $this->getForm()->handleRequest($request);
        $this->handleForm($request->get('page'));
    }
1223726
public function handleContentsAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ez:infocollector:read');

        $contents = $request->request->get('ContentId', []);
        $count = count($contents);

        if (empty($contents)) {
            $this->addFlashMessage('errors', 'contents_not_selected');

            return $this->redirectToRoute('netgen_information_collection.route.admin.overview');
        }

        if ($request->request->has('DeleteCollectionByContentAction')) {
            $query = new Query([
                'contents' => $contents,
            ]);
            $this->service->deleteCollectionByContent($query);

            $this->addFlashMessage('success', 'content_removed', $count);

            return $this->redirectToRoute('netgen_information_collection.route.admin.overview');
        }

        $this->addFlashMessage('error', 'something_went_wrong');

        return $this->redirectToRoute('netgen_information_collection.route.admin.overview');
    }
935513
public function EditForm($request = null) {
		HtmlEditorField::include_js();

		$cur = $this->getCurrentPageID();
		if ($cur) {
			$record = $this->currentPage();
			if (!$record)
				return false;
			if ($record && !$record->canView())
				return Security::permissionFailure($this);
		}

		if ($this->hasMethod('getEditForm')) {
			return $this->getEditForm($this->getCurrentPageID());
		}

		return false;
	}
954699
public function accept(Request $request)
    {
        if (! $request->has('token')) abort(404);
        if (! $invitation = $this->validateToken($request->input('token'))) abort(404);
        return $this->showAcceptUserInvitationForm($invitation);
    }
804500
protected function folderIsNotAccessible(Request $request)
    {
        if (isset($request['folder']) && empty($request->get('folder'))) {
            return true;
        }

        return ! Storage::exists($this->currentDir) && $request->has('folder') || $request->get('folder') === 'public';
    }
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');
    }
1086742
public function login(Request $request)
    {
        $form = $this->form(new LoginForm());
        $form->handleRequest($request);

        if ($form->isValid()) {
            if ($this->attemptLogin($request, $form)) {
                return $this->sendLoginResponse($request);
            }
        }

        // If the class is using the ThrottlesLogins trait, we can automatically throttle
        // the login attempts for this application. We'll key this by the username and
        // the IP address of the client making these requests into this application.
        if ($this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        // If the login attempt was unsuccessful we will increment the number of attempts
        // to login and redirect the user back to the login form. Of course, when this
        // user surpasses their maximum number of attempts they will get locked out.
        $this->incrementLoginAttempts($request);

        $this->sendFailedLoginResponse($request);
    }
1241426
public function handle(Request $request)
	{
		// execute response
		$response = $this->next($request);

		// check for presence of callback param
		// if we have one lets replace response content with a function executing the 
		// current response content
		if ($callback = $request->getVar('callback', null))
		{
			$response->headers->set('content-type', 'application/javascript');
			$response->setContent(sprintf('%s(%s);', $callback, $response->getContent()));
		}

		// return response
		return $response;
	}
694663
public function changeAction(Request $request): Response
    {
        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);

        if (!$this->container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
            throw new AccessDeniedException('You have to be registered user to access this section.');
        }

        $user = $this->container->get('security.token_storage')->getToken()->getUser();

        $changeUser = new ChangeUser($user);
        $formType = $this->getSyliusAttribute($request, 'form', ChangeUserType::class);
        $form = $this->createResourceForm($configuration, $formType, $changeUser);

        if (in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true) && $form->handleRequest($request)->isValid()) {
            return $this->handleChange($request, $configuration, $changeUser);
        }

        if (!$configuration->isHtmlRequest()) {
            return $this->viewHandler->handle($configuration, View::create($form, Response::HTTP_BAD_REQUEST));
        }

        $template = $this->getSyliusAttribute($request, 'template', null);

        Assert::notNull($template, 'Template is not configured.');

        return $this->container->get('templating')->renderResponse($template, [
            'form' => $form->createView()
        ]);
    }
849382
public function draftAction(Request $request)
    {
        $id = $request->get($this->admin->getIdParameter());

        return $this->changePageStatus($id, PageInterface::STATUS_DRAFT);
    }