# UserController

Extends \NPS\Controller\AbstractController

Controller for user account related stuff

author | Lukas Korinek
package | Default

### Methods

## __construct

    __construct(\Symfony\Component\HttpFoundation\RequestStack $stack)

inherited

### Arguments

#### $stack

`\Symfony\Component\HttpFoundation\RequestStack`

## Activates a user account via token

    activateAccountAction(\Symfony\Component\HttpFoundation\Request $request, \NPS\Repository\TokenRepository $tokenRepo)

Route | ("/user/activate", methods={"POST"})

### Arguments

#### $request

`\Symfony\Component\HttpFoundation\Request`

#### $tokenRepo

`\NPS\Repository\TokenRepository`

## Flushes any doctrine related changes

    flush()

inherited

## Returns current request

    getRequest() : \Symfony\Component\HttpFoundation\Request

inherited

### Response

`\Symfony\Component\HttpFoundation\Request`

## Issues a reset password token

    issueResetTokenAction(\Symfony\Component\HttpFoundation\Request $request, \NPS\Repository\UserRepository $repo, \NPS\Factory\TokenFactory $factory, \NPS\DependencyInjection\Mailer $mailer)

Route | ("/user/reset/issue", methods={"POST"})

### Arguments

#### $request

`\Symfony\Component\HttpFoundation\Request`

#### $repo

`\NPS\Repository\UserRepository`

#### $factory

`\NPS\Factory\TokenFactory`

#### $mailer

`\NPS\DependencyInjection\Mailer`

## Lists all users in the application

    listAction(\NPS\Repository\UserRepository $repo, \Symfony\Component\HttpFoundation\Request $request)

Route | ("/user/list")
Security | ("is_granted('ROLE_MANAGER') or is_granted('ROLE_ADMIN')")

### Arguments

#### $repo

`\NPS\Repository\UserRepository`

#### $request

`\Symfony\Component\HttpFoundation\Request`

## Resets password via token

    passwordResetAction(\Symfony\Component\HttpFoundation\Request $request, \NPS\Repository\TokenRepository $tokenRepo)

Route | ("/user/reset/update", methods={"POST"})

### Arguments

#### $request

`\Symfony\Component\HttpFoundation\Request`

#### $tokenRepo

`\NPS\Repository\TokenRepository`

## Registers a new user

    registerAction(\Symfony\Component\HttpFoundation\Request $request, \NPS\Repository\UserRepository $repo, \NPS\Factory\UserFactory $userFactory, \NPS\Factory\TokenFactory $tokenFactory, \NPS\DependencyInjection\Mailer $mailer)

Route | ("/user/register", methods={"POST"})

### Arguments

#### $request

`\Symfony\Component\HttpFoundation\Request`

#### $repo

`\NPS\Repository\UserRepository`

#### $userFactory

`\NPS\Factory\UserFactory`

#### $tokenFactory

`\NPS\Factory\TokenFactory`

#### $mailer

`\NPS\DependencyInjection\Mailer`

## Resends user account activation email

    resendActivationEmail(\NPS\Factory\TokenFactory $factory, \NPS\DependencyInjection\Mailer $mailer, \Symfony\Component\HttpFoundation\Request $request, \NPS\Repository\UserRepository $repo)

Route | ("/user/activation-resend", methods={"POST"})

### Arguments

#### $factory

`\NPS\Factory\TokenFactory`

#### $mailer

`\NPS\DependencyInjection\Mailer`

#### $request

`\Symfony\Component\HttpFoundation\Request`

#### $repo

`\NPS\Repository\UserRepository`

## Creates a response

    response(array $data = array()) : \Symfony\Component\HttpFoundation\Response

inherited

### Arguments

#### $data

`array`

### Response

`\Symfony\Component\HttpFoundation\Response`

## Changes user role assignments

    rolesAction(\NPS\Repository\UserRepository $repo, \Symfony\Component\HttpFoundation\Request $request)

Route | ("/user/roles", methods={"POST"})
Security | ("is_granted('ROLE_MANAGER') or is_granted('ROLE_ADMIN')")

### Arguments

#### $repo

`\NPS\Repository\UserRepository`

#### $request

`\Symfony\Component\HttpFoundation\Request`

### Properties

## Current request

    request : \Symfony\Component\HttpFoundation\Request

inherited

var | Current request

### Type(s)

`\Symfony\Component\HttpFoundation\Request`