PHP Class FOS\UserBundle\Model\User

Author: Thibault Duplessis ([email protected])
Author: Johannes M. Schmitt ([email protected])
Inheritance: implements FOS\UserBundle\Model\UserInterface, implements FOS\UserBundle\Model\GroupableInterface
Exibir arquivo Open project: KnpLabs/KnpUserBundle Class Usage Examples

Protected Properties

Property Type Description
$algorithm string The algorithm to use for hashing
$confirmationToken string Random string sent to the user email address in order to verify it
$createdAt DateTime
$credentialsExpireAt DateTime
$credentialsExpired boolean
$email string
$emailCanonical string
$enabled boolean
$expired boolean
$expiresAt DateTime
$groups Doctrine\Common\Collections\Collection
$id
$lastLogin DateTime
$locked boolean
$password string Encrypted password. Must be persisted.
$passwordRequestedAt DateTime
$plainPassword string Plain password. Used for model validation. Must not be persisted.
$roles array
$salt string The salt to use for hashing
$updatedAt DateTime
$username string
$usernameCanonical string

Public Methods

Method Description
__construct ( )
__toString ( )
addGroup ( FOS\UserBundle\Model\GroupInterface $group ) : null Add a group to the user groups
addRole ( $role )
equals ( Symfony\Component\Security\Core\User\AccountInterface $account ) : boolean Implementation of AccountInterface.
eraseCredentials ( ) Removes sensitive data from the user.
generateConfirmationToken ( ) : null Generate confirmationToken if it is not set
getAlgorithm ( )
getConfirmationToken ( ) : string Get confirmationToken
getCreatedAt ( ) : DateTime
getEmail ( ) : string Get email
getEmailCanonical ( ) : string Get the canonical email in search and sort queries
getGroupNames ( ) : array Gets the name of the groups which includes the user
getGroups ( ) : Doctrine\Common\Collections\Collection Get groups granted to the user
getId ( ) : mixed Return the user unique id
getLastLogin ( ) : DateTime
getPassword ( ) : string Implements AccountInterface Get the encrypted password
getPasswordRequestedAt ( ) : DateTime Get the timestamp that the user requested a password reset.
getPlainPassword ( )
getRoles ( ) : array Return the user roles Implements AccountInterface
getSalt ( ) : string Implementation of AccountInterface
getUpdatedAt ( ) : DateTime
getUsername ( ) : string
getUsernameCanonical ( ) : string Get the canonical username in search and sort queries
hasGroup ( string $name ) : boolean Indicates whether the user belongs to the specified group or not
hasRole ( string $role ) : void Never use this to check if this user has access to anything!
incrementCreatedAt ( )
incrementUpdatedAt ( )
isAccountNonExpired ( ) : boolean Checks whether the user's account has expired.
isAccountNonLocked ( ) : boolean Checks whether the user is locked.
isCredentialsExpired ( )
isCredentialsNonExpired ( ) : boolean Checks whether the user's credentials (password) has expired.
isEnabled ( ) : boolean Checks whether the user is enabled.
isExpired ( )
isLocked ( )
isPasswordRequestNonExpired ( integer $ttl ) : boolean Checks whether the password reset request has expired.
isSuperAdmin ( ) : boolean Tell if the the given user has the super admin role
isUser ( FOS\UserBundle\Model\UserInterface $user = null ) : boolean Tell if the the given user is this user Useful when not hydrating all fields.
removeGroup ( FOS\UserBundle\Model\GroupInterface $group ) : null Remove a group from the user groups
removeRole ( $role )
setAlgorithm ( $algorithm )
setConfirmationToken ( $confirmationToken ) : null Set confirmationToken
setCredentialsExpireAt ( DateTime $date )
setCredentialsExpired ( $boolean )
setEmail ( string $email ) Set email.
setEmailCanonical ( string $emailCanonical ) Set emailCanonical.
setEnabled ( boolean $boolean )
setExpired ( boolean $boolean ) : void Sets this user to expired
setExpiresAt ( DateTime $date )
setLastLogin ( DateTime $time )
setLocked ( $boolean )
setPassword ( string $password ) : void Sets the hashed password.
setPasswordRequestedAt ( DateTime $date ) Set the timestamp that the user requested a password reset.
setPlainPassword ( $password )
setRoles ( array $roles )
setSuperAdmin ( boolean $boolean ) : void Sets the super admin status
setUsername ( string $username ) Set username.
setUsernameCanonical ( string $usernameCanonical ) Set usernameCanonical.

Method Details

__construct() public method

public __construct ( )

__toString() public method

public __toString ( )

addGroup() public method

Add a group to the user groups
public addGroup ( FOS\UserBundle\Model\GroupInterface $group ) : null
$group FOS\UserBundle\Model\GroupInterface
return null

addRole() public method

public addRole ( $role )

equals() public method

Implementation of AccountInterface.
public equals ( Symfony\Component\Security\Core\User\AccountInterface $account ) : boolean
$account Symfony\Component\Security\Core\User\AccountInterface
return boolean

eraseCredentials() public method

Implements AccountInterface
public eraseCredentials ( )

generateConfirmationToken() public method

Generate confirmationToken if it is not set
public generateConfirmationToken ( ) : null
return null

getAlgorithm() public method

public getAlgorithm ( )

getConfirmationToken() public method

Get confirmationToken
public getConfirmationToken ( ) : string
return string

getCreatedAt() public method

public getCreatedAt ( ) : DateTime
return DateTime

getEmail() public method

Get email
public getEmail ( ) : string
return string

getEmailCanonical() public method

Get the canonical email in search and sort queries
public getEmailCanonical ( ) : string
return string

getGroupNames() public method

Gets the name of the groups which includes the user
public getGroupNames ( ) : array
return array

getGroups() public method

Get groups granted to the user
public getGroups ( ) : Doctrine\Common\Collections\Collection
return Doctrine\Common\Collections\Collection

getId() public method

Return the user unique id
public getId ( ) : mixed
return mixed

getLastLogin() public method

public getLastLogin ( ) : DateTime
return DateTime

getPassword() public method

Implements AccountInterface Get the encrypted password
public getPassword ( ) : string
return string

getPasswordRequestedAt() public method

Get the timestamp that the user requested a password reset.
public getPasswordRequestedAt ( ) : DateTime
return DateTime

getPlainPassword() public method

public getPlainPassword ( )

getRoles() public method

Return the user roles Implements AccountInterface
public getRoles ( ) : array
return array The roles

getSalt() public method

Implementation of AccountInterface
public getSalt ( ) : string
return string

getUpdatedAt() public method

public getUpdatedAt ( ) : DateTime
return DateTime

getUsername() public method

public getUsername ( ) : string
return string

getUsernameCanonical() public method

Get the canonical username in search and sort queries
public getUsernameCanonical ( ) : string
return string

hasGroup() public method

Indicates whether the user belongs to the specified group or not
public hasGroup ( string $name ) : boolean
$name string Name of the group
return boolean

hasRole() public method

Use the SecurityContext, or an implementation of AccessDecisionManager instead, e.g. $securityContext->vote('ROLE_USER');
public hasRole ( string $role ) : void
$role string
return void

incrementCreatedAt() public method

public incrementCreatedAt ( )

incrementUpdatedAt() public method

public incrementUpdatedAt ( )

isAccountNonExpired() public method

Implements AdvancedAccountInterface
public isAccountNonExpired ( ) : boolean
return boolean true if the user's account is non expired, false otherwise

isAccountNonLocked() public method

Implements AdvancedAccountInterface
public isAccountNonLocked ( ) : boolean
return boolean true if the user is not locked, false otherwise

isCredentialsExpired() public method

isCredentialsNonExpired() public method

Implements AdvancedAccountInterface
public isCredentialsNonExpired ( ) : boolean
return boolean true if the user's credentials are non expired, false otherwise

isEnabled() public method

Implements AdvancedAccountInterface
public isEnabled ( ) : boolean
return boolean true if the user is enabled, false otherwise

isExpired() public method

public isExpired ( )

isLocked() public method

public isLocked ( )

isPasswordRequestNonExpired() public method

Checks whether the password reset request has expired.
public isPasswordRequestNonExpired ( integer $ttl ) : boolean
$ttl integer Requests older than this many seconds will be considered expired
return boolean true if the users's password request is non expired, false otherwise

isSuperAdmin() public method

Tell if the the given user has the super admin role
public isSuperAdmin ( ) : boolean
return boolean

isUser() public method

Tell if the the given user is this user Useful when not hydrating all fields.
public isUser ( FOS\UserBundle\Model\UserInterface $user = null ) : boolean
$user FOS\UserBundle\Model\UserInterface
return boolean

removeGroup() public method

Remove a group from the user groups
public removeGroup ( FOS\UserBundle\Model\GroupInterface $group ) : null
$group FOS\UserBundle\Model\GroupInterface
return null

removeRole() public method

public removeRole ( $role )

setAlgorithm() public method

public setAlgorithm ( $algorithm )

setConfirmationToken() public method

Set confirmationToken
public setConfirmationToken ( $confirmationToken ) : null
return null

setCredentialsExpireAt() public method

public setCredentialsExpireAt ( DateTime $date )
$date DateTime

setCredentialsExpired() public method

public setCredentialsExpired ( $boolean )

setEmail() public method

Set email.
public setEmail ( string $email )
$email string

setEmailCanonical() public method

Set emailCanonical.
public setEmailCanonical ( string $emailCanonical )
$emailCanonical string

setEnabled() public method

public setEnabled ( boolean $boolean )
$boolean boolean

setExpired() public method

Sets this user to expired
public setExpired ( boolean $boolean ) : void
$boolean boolean
return void

setExpiresAt() public method

public setExpiresAt ( DateTime $date )
$date DateTime

setLastLogin() public method

public setLastLogin ( DateTime $time )
$time DateTime

setLocked() public method

public setLocked ( $boolean )

setPassword() public method

Sets the hashed password.
public setPassword ( string $password ) : void
$password string
return void

setPasswordRequestedAt() public method

Set the timestamp that the user requested a password reset.
public setPasswordRequestedAt ( DateTime $date )
$date DateTime

setPlainPassword() public method

public setPlainPassword ( $password )

setRoles() public method

public setRoles ( array $roles )
$roles array

setSuperAdmin() public method

Sets the super admin status
public setSuperAdmin ( boolean $boolean ) : void
$boolean boolean
return void

setUsername() public method

Set username.
public setUsername ( string $username )
$username string

setUsernameCanonical() public method

Set usernameCanonical.
public setUsernameCanonical ( string $usernameCanonical )
$usernameCanonical string

Property Details

$algorithm protected_oe property

The algorithm to use for hashing
protected string $algorithm
return string

$confirmationToken protected_oe property

Random string sent to the user email address in order to verify it
protected string $confirmationToken
return string

$createdAt protected_oe property

protected DateTime $createdAt
return DateTime

$credentialsExpireAt protected_oe property

protected DateTime $credentialsExpireAt
return DateTime

$credentialsExpired protected_oe property

protected bool $credentialsExpired
return boolean

$email protected_oe property

protected string $email
return string

$emailCanonical protected_oe property

protected string $emailCanonical
return string

$enabled protected_oe property

protected bool $enabled
return boolean

$expired protected_oe property

protected bool $expired
return boolean

$expiresAt protected_oe property

protected DateTime $expiresAt
return DateTime

$groups protected_oe property

protected Collection,Doctrine\Common\Collections $groups
return Doctrine\Common\Collections\Collection

$id protected_oe property

protected $id

$lastLogin protected_oe property

protected DateTime $lastLogin
return DateTime

$locked protected_oe property

protected bool $locked
return boolean

$password protected_oe property

Encrypted password. Must be persisted.
protected string $password
return string

$passwordRequestedAt protected_oe property

protected DateTime $passwordRequestedAt
return DateTime

$plainPassword protected_oe property

Plain password. Used for model validation. Must not be persisted.
protected string $plainPassword
return string

$roles protected_oe property

protected array $roles
return array

$salt protected_oe property

The salt to use for hashing
protected string $salt
return string

$updatedAt protected_oe property

protected DateTime $updatedAt
return DateTime

$username protected_oe property

protected string $username
return string

$usernameCanonical protected_oe property

protected string $usernameCanonical
return string