@param Request $request

@Config\Route("/new", name="open_orchestra_user_admin_new")
@Config\Method({"GET", "POST"})

@return Response
4268
public function newAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, UserInterface::ENTITY_TYPE);

        $userClass = $this->container->getParameter('open_orchestra_user.document.user.class');
        /** @var UserInterface $user */
        $user = new $userClass();
        $user->setEmail($request->get('email'));
        $user->setLastName($request->get('lastName'));
        $user->setFirstName($request->get('firstName'));

        $form = $this->createForm('oo_registration_user', $user, array(
                'action' => $this->generateUrl('open_orchestra_user_admin_new'),
                'required_password' => true,
                'validation_groups' => array('Registration'),
            )
        );

        $form->handleRequest($request);

        if ($form->isValid()) {
            $documentManager = $this->get('object_manager');
            $documentManager->persist($user);
            $documentManager->flush();
            $message = $this->get('translator')->trans('open_orchestra_user_admin.new.success');

            $this->dispatchEvent(UserEvents::USER_CREATE, new UserEvent($user));
            $response = new Response(
                $message,
                Response::HTTP_CREATED,
                array('Content-type' => 'text/plain; charset=utf-8', 'userId' => $user->getId())
            );

            return $response;
        }

        return $this->renderAdminForm($form);
    }
680257
public function listAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, UserInterface::ENTITY_TYPE);
        $mapping = array(
            'username' => 'username',
            'groups' => 'groups.label'
        );
        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
        $repository = $this->get('open_orchestra_user.repository.user');
        $language = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getBackOfficeLanguage();

        if ($this->get('security.authorization_checker')->isGranted(ContributionRoleInterface::PLATFORM_ADMIN)) {
            $collection = $repository->findForPaginate($configuration, $language);
            $recordsTotal = $repository->count();
            $recordsFiltered = $repository->countWithFilter($configuration, $language);
        } else {
            $sitesId = $this->getAvailableSiteIds();
            $collection = $repository->findForPaginateFilterBySiteIds($configuration, $language, $sitesId);
            $recordsTotal = $repository->countFilterBySiteIds($sitesId);
            $recordsFiltered = $repository->countWithFilterAndSiteIds($configuration, $language, $sitesId);
        }

        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('user_collection', $collection);
        $facade->recordsTotal = $recordsTotal;
        $facade->recordsFiltered = $recordsFiltered;

        return $facade;
    }
1254740
public function editAction(Request $request)
    {
        $form     = $this->validateRequestParameters($request);
        $resource = $this->mapper->getResource($request->get('id'));

        $this->mapper->populateResourceWithForm($resource, $form);
        $this->mapper->update($resource);

        // returns an empty 200 (OK)
        return new Response();
    }
395662
public function edit(Request $request)
    {
        $post = $this->api('post.fetch', $request->route('post'))->get();

        event(new UserEditingPost($post));

        if ($post->trashed()) {
            return abort(404);
        }

        $this->authorize('edit', $post);

        $thread = $post->thread;
        $category = $post->thread->category;

        return view('forum::post.edit', compact('category', 'thread', 'post'));
    }
554276
protected function renderForm(Request $request, UserInterface $user, $selfEdit)
    {
        $action = $this->generateUrl('open_orchestra_user_admin_user_form', array('userId' => $user->getId()));
        $editGroups = true;

        if ($selfEdit) {
            $action = $this->generateUrl('open_orchestra_user_admin_user_self_form');
            $editGroups = false;
        }

        $form = $this->createForm('oo_user', $user, array(
            'action' => $action,
            'edit_groups' => $editGroups,
            'self_editing' => $selfEdit,
            'validation_groups' => array('Profile', 'UpdatePassword', 'Default'),
            )
        );
        $form->handleRequest($request);

        if ($form->isValid()) {
            if ('' != $user->getPlainPassword()) {
                $userManager = $this->get('fos_user.user_manager');
                $userManager->updatePassword($user);
                $this->dispatchEvent(UserEvents::USER_CHANGE_PASSWORD, new UserEvent($user));
            }
            $this->handleForm($form, $this->get('translator')->trans('open_orchestra_user_admin.update.success'));
            $this->dispatchEvent(UserEvents::USER_UPDATE, new UserEvent($user));
        }

        return $this->renderAdminForm($form);
    }
466627
public function setup(Request $request)
    {
        $master = $request->master;
        if ($master == 'another') {
            $another_file = $request->other_path;
            $views_content = strstr(substr(strstr($another_file, 'views/'), 6), '.blade.php', true);
            $master = str_replace('/', '.', $views_content);
        }
        $this->initialSettings($master);
        $admin_id = $request->admin_id;
        $admin = User::find($admin_id);
        $admin->ticketit_admin = true;
        $admin->save();

        return redirect('/'.Setting::grab('main_route'));
    }
844988
public function createAction(Request $request)
    {
        $template = new Template();

        $form = $this->createForm(TemplateType::class, $template);
        $form->handleRequest($request);

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

            $em->persist($template);
            $em->flush();

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

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

		$payload = new Blank();
		if ($request->isMethod('POST')) {
			$post = $request->request;
			$user = $this->getServiceContainer()->getAuthManager()->getUser();
			$domain = new UserDomain($this->getServiceContainer());
			$serializer = User::getSerializer();

			$fields = $serializer->getFields();
			$fields[] = 'display_name_user_select';
			$attribs = [];

			foreach ($fields as $field) {
				if ($post->has($field)) {
					$attribs[$field] = $post->get($field);
				}
			}

			$payload = $domain->update($user->getId(), ['attributes' => $attribs]);
		}
		return $this->responder->run($request, $payload);
	}
319929
public function create(Request $request)
    {
        if (!$this->can('create-' . Str::plural($this->slug), auth()->user()->id)) {
            abort(404);
        }

        return view('laramin::models.add-edit')
            ->withStatus('Add')
            ->withColumns($this->columns())
            ->withType($this->type);
    }
1036159
public function newUserAction(Request $request)
    {
        $adminContext = $this->get('admin.context');
        $config       = $adminContext->getActiveModuleForAction('add', 'admin-users');

        /** @var AdminUser $user */
        $user = new $config['entity']();
        $user->setIsActive(true);

        $form = $this->createFormBuilder($user, [
            'action' => $this->generateUrl('admin.user.new'),
            'attr'   => ['class' => 'form-horizontal']
        ])
            ->add('login', null, ['attr' => ['data-column' => 'text']])
            ->add('password', RepeatedType::class, [
                'type'            => PasswordType::class,
                'invalid_message' => 'The password fields must match.',
                'options'         => ['attr' => ['data-column' => 'text']],
                'required'        => true,
                'first_options'   => ['label' => 'Password'],
                'second_options'  => ['label' => 'Repeat Password'],
            ])
            ->add('rights', null, ['attr' => ['style' => 'width: 400px;', 'data-column' => 'select']])
            ->getForm();

        $form->handleRequest($request);

        if ($form->isValid()) {
            if ($user->getRights()->count()) {
                /** @var PasswordEncoderInterface $encoder */
                $encoder  = $this->get('security.encoder_factory')->getEncoder($user);
                $password = $encoder->encodePassword($user->getPassword(), $user->getSalt());

                $user
                    ->setPassword($password)
                    ->setIsActive(true);

                $m = $this->get('doctrine')->getManager();

                $m->persist($user);
                $m->flush();

                $this->addFlash('success', 'New user has been added!');

                return $this->redirectToRoute('admin.dictionary.default', ['module' => 'admin-users']);
            } else {
                $form->get('rights')->addError(new FormError('Minimum one right need to be added.'));
            }
        }

        $vars = [
            'object'       => $user,
            'moduleConfig' => $this->get('admin.context')->getActiveModuleForAction('create'),
            'form'         => $form->createView(),
        ];

        return $this->render('@YAdmin/Security/new-user.html.twig', $vars);
    }
1194726
public function phpAction(Request $request)
    {
        $show = $request->query->get('show', -1);

        ob_start();
        phpinfo($show);
        $output = ob_get_clean();

        return new Response($output);
    }
727811
public function createAction(Request $request)
    {
        $entity = new User();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $userService = $this->get("flowcode.user");
            $userService->create($entity);

            return $this->redirect($this->generateUrl('admin_user_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
766705
public function addAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');

        $user = $this->getUserClassInstance();

        $options = array('password_required' => true, 'langs' => $this->container->getParameter('kunstmaan_admin.admin_locales'), 'validation_groups' => array('Registration'), 'data_class' => get_class($user));
        $formTypeClassName = $user->getFormTypeClass();
        $formType = new $formTypeClassName();

        if ($formType instanceof RoleDependentUserFormInterface) {
            // to edit groups and enabled the current user should have ROLE_SUPER_ADMIN
            $options['can_edit_all_fields'] = $this->isGranted('ROLE_SUPER_ADMIN');
        }

        $form = $this->createForm(
            $formTypeClassName,
            $user,
            $options
        );

        if ($request->isMethod('POST')) {
            $form->handleRequest($request);
            if ($form->isSubmitted() && $form->isValid()) {
                $user->setPasswordChanged(true);
                /* @var UserManager $userManager */
                $userManager = $this->container->get('fos_user.user_manager');
                $userManager->updateUser($user, true);

                $this->addFlash(
                    FlashTypes::SUCCESS,
                    $this->container->get('translator')->trans('kuma_user.users.add.flash.success.%username%', [
                        '%username%' => $user->getUsername(),
                    ])
                );

                return new RedirectResponse($this->generateUrl('KunstmaanUserManagementBundle_settings_users'));
            }
        }

        return array(
            'form' => $form->createView(),
        );
    }
49762
public function addRole(Request $request)
    {
        $user = \App\User::findOrfail($request->user_id);
        $user->assignRole($request->role_name);

        return redirect('scaffold-users/edit/'.$request->user_id);
    }
191613
public function formAction(Request $request)
    {
        $option = array('action' => $this->generateUrl('open_orchestra_backoffice_internal_link_form'));

        $option["method"] = "POST";
        if ("PATCH" === $request->getMethod()) {
            $option["validation_groups"] = false;
            $option["method"] = "PATCH";
        }
        $form = $this->createForm(
            'oo_internal_link',
            $request->query->all(),
            $option
        );

        $form->handleRequest($request);

        return $this->renderAdminForm($form);
    }
1115865
public function newAction(Request $request)
    {
        $redirection = new Redirection();

        $form = $this->getRedirectionForm($redirection, '#new-redirection-form-container');
        $form->handleRequest($request);

        if ($request->query->get('novalidate', false) === false) {
            if ($form->isValid()) {
                if ($redirection->getLink()->getLinkType() !== Link::TYPE_NONE) {
                    $em = $this->getDoctrine()->getManager();
                    $em->persist($redirection);
                    $em->flush();

                    $this->congrat($this->get('translator')->trans('victoire.redirection.create.success'));

                    return new Response($this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                        'isOpened'  => true,
                        'form'      => $this->getRedirectionForm(new Redirection(), '#new-redirection-form-container')->createView(),
                        'icTrigger' => [
                            'target' => '#redirections-list-container',
                            'url'    => $this->generateUrl('victoire_redirection_showListItem', [
                                'id' => $redirection->getId(),
                            ]),
                        ],
                    ]), 200, [
                        'X-Inject-Alertify' => true,
                    ]);
                } else {
                    // force form error when no link submitted
                    $form->addError(new FormError('This value should not be blank.'));
                }
            } else {
                $this->warn($this->get('translator')->trans('victoire.404.form.error.unvalid'));
            }

            return new Response($this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                'form'     => $form->createView(),
                'isOpened' => true,
            ]), 200, [
                'X-Inject-Alertify' => true,
            ]);
        }

        // rebuild form to avoid wrong form error
        $form = $this->getRedirectionForm($redirection, '#new-redirection-form-container');

        return new JsonResponse([
            'html' => $this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                'form'      => $form->createView(),
                'isOpened'  => true,
            ]),
        ]);
    }
118315
public function requestAction(Request $request)
    {
        $form = $this
            ->createForm(new UserForgotPassType())
            ->handleRequest($request)
        ;

        $obj = $form->getData();

        $user = $this->getDoctrine()->getRepository('FOMUserBundle:User')->findOneByUsername($obj['search']);
        if ($user === null) {
            $user = $this->getDoctrine()->getRepository('FOMUserBundle:User')->findOneByEmail($obj['search']);
        }

        if (!$user) {
            $form->addError(new FormError($this->get("templating")->render(
                'FOMUserBundle:Password:request-error-nosuchuser.html.twig',
                array("search" => $obj))));
            return array('form' => $form->createView());
        } elseif ($user->getRegistrationToken()) {
            $form->addError(new FormError($this->get("templating")->render(
                'FOMUserBundle:Password:request-error-userinactive.html.twig', array("user" => $user))));
            return array(
                'user' => $user,
                'form' => $form->createView());
        }

        $this->setResetToken($user);

        return $this->redirect($this->generateUrl('fom_user_password_send'));
    }