# User

Implements \NPS\Model\IDomainObject, \Symfony\Component\Security\Core\User\UserInterface

Represents a user model object

author | Lukas Korinek
package | Default

### Methods

## __construct

    __construct(\NPS\Entity\UserEntity $entity, \Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface $encoder)

### Arguments

#### $entity

`\NPS\Entity\UserEntity`

#### $encoder

`\Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface`

## Acknowledges that the user has been logged in

    acknowledgeLogin()

## Activates the user's account

    activate()

## Denies access to a knowledge base by bind id

    denyAccess(integer $bindId)

### Arguments

#### $bindId

`integer`

## eraseCredentials

    eraseCredentials()

inheritDoc |

## Gets the date of last credentials update

    getCredentialsUpdateDate() : \DateTime

### Response

`\DateTime`

## Returns the date of user account activation

    getDateActivated() : \DateTime|null

### Response

`\DateTime|null`

## Returns the date of user account registration

    getDateRegistered() : \DateTime

### Response

`\DateTime`

## Gets the users email

    getEmail() : string

### Response

`string`

## Can be adjusted to dynamically select encoder by role

    getEncoderName()

inheritDoc |

## Gets the entity of the object

    getEntity() : \NPS\Entity\IEntity

inheritDoc |

### Response

`\NPS\Entity\IEntity`

## Gets knowledge base bind id grants associated with this user

    getGrants() : array

### Response

`array`

## Gets the id of the object

    getId() : integer

inheritDoc |

### Response

`integer`

## Returns the date of last user login

    getLastLoginDate() : \DateTime|null

### Response

`\DateTime|null`

## getPassword

    getPassword()

inheritDoc |

## getRoles

    getRoles()

inheritDoc |

## getSalt

    getSalt()

inheritDoc |

## getUsername

    getUsername()

inheritDoc |

## Grants access to a knowledge base by bind id

    grantAccess(integer $bindId)

### Arguments

#### $bindId

`integer`

## Checks if the user is active

    isActive() : boolean

### Response

`boolean`

## Validates and changes user's role assignments

    setRoles(array $roles)

### Arguments

#### $roles

`array`

## Updates user's password

    updatePassword(string $password)

### Arguments

#### $password

`string`

New password

### Constants

## ROLES

    ROLES

### Properties

## entity

    entity : \NPS\Entity\UserEntity

var |

### Type(s)

`\NPS\Entity\UserEntity`

## encoder

    encoder : \Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface

var |

### Type(s)

`\Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface`

## roles

    roles : array

var |

### Type(s)

`array`