Overview

Namespaces

  • Charcoal
    • Object
    • User
      • Acl

Classes

  • AbstractUser
  • Authenticator
  • Authorizer
  • AuthToken
  • AuthTokenMetadata
  • GenericUser

Interfaces

  • UserInterface
  • Overview
  • Namespace
  • Class

Class AbstractUser

Full implementation, as abstract class, of the UserInterface.

Charcoal\Model\AbstractModel
Extended by Charcoal\Object\Content implements Charcoal\Object\ContentInterface, Charcoal\Object\RevisionableInterface uses Charcoal\Object\RevisionableTrait
Extended by Charcoal\User\AbstractUser implements Charcoal\User\UserInterface, Charcoal\Config\ConfigurableInterface uses Charcoal\Config\ConfigurableTrait (not available)

Direct known subclasses

Charcoal\User\GenericUser
Abstract
Namespace: Charcoal\User
Located at Charcoal/User/AbstractUser.php
Methods summary
public string
# key( )

IndexableTrait > key()

IndexableTrait > key()

Returns

string
public User
# setUsername( string $username )

Force a lowercase username

Force a lowercase username

Parameters

$username
The username (also the login name).

Returns

User
Chainable

Throws

InvalidArgumentException
If the username is not a string.

Implementation of

Charcoal\User\UserInterface::setUsername()
public string
# username( )

Returns

string

Implementation of

Charcoal\User\UserInterface::username()
public User
# setEmail( string $email )

Parameters

$email
The user email.

Returns

User
Chainable

Throws

InvalidArgumentException
If the email is not a string.

Implementation of

Charcoal\User\UserInterface::setEmail()
public string
# email( )

Returns

string

Implementation of

Charcoal\User\UserInterface::email()
public Charcoal\User\UserInterface
# setPassword( string|null $password )

Parameters

$password
The user password. Encrypted in storage.

Returns

Charcoal\User\UserInterface
Chainable

Throws

InvalidArgumentException
If the password is not a string (or null, to reset).

Implementation of

Charcoal\User\UserInterface::setPassword()
public string
# password( )

Returns

string

Implementation of

Charcoal\User\UserInterface::password()
public Charcoal\User\UserInterface
# setActive( boolean $active )

Parameters

$active
The active flag.

Returns

Charcoal\User\UserInterface
Chainable

Overrides

Charcoal\Object\Content::setActive()

Implementation of

Charcoal\User\UserInterface::setActive()
public boolean
# active( )

Returns

boolean

Overrides

Charcoal\Object\Content::active()

Implementation of

Charcoal\User\UserInterface::active()
public Charcoal\User\AbstractUser
# setRoles( string|string[]|null $roles )

Parameters

$roles
The ACL roles this user belongs to.

Returns

Charcoal\User\AbstractUser
Chainable

Throws

InvalidArgumentException
If the roles argument is invalid.
public string[]
# roles( )

Returns

string[]
public Charcoal\User\AbstractUser
# setLastLoginDate( string|DateTimeInterface|null $lastLoginDate )

Parameters

$lastLoginDate
The last login date.

Returns

Charcoal\User\AbstractUser
Chainable

Throws

InvalidArgumentException
If the ts is not a valid date/time.

Implementation of

Charcoal\User\UserInterface::setLastLoginDate()
public DateTimeInterface|null
# lastLoginDate( )

Returns

DateTimeInterface|null

Implementation of

Charcoal\User\UserInterface::lastLoginDate()
public Charcoal\User\UserInterface
# setLastLoginIp( string|integer|null $ip )

Parameters

$ip
The last login IP address.

Returns

Charcoal\User\UserInterface
Chainable

Throws

InvalidArgumentException
If the IP is not an IP string, an integer, or null.

Implementation of

Charcoal\User\UserInterface::setLastLoginIp()
public string
# lastLoginIp( )

Get the last login IP in x.x.x.x format

Get the last login IP in x.x.x.x format

Returns

string

Implementation of

Charcoal\User\UserInterface::lastLoginIp()
public Charcoal\User\UserInterface
# setLastPasswordDate( string|DateTimeInterface|null $lastPasswordDate )

Parameters

$lastPasswordDate
The last password date.

Returns

Charcoal\User\UserInterface
Chainable

Throws

InvalidArgumentException
If the passsword date is not a valid DateTime.

Implementation of

Charcoal\User\UserInterface::setLastPasswordDate()
public DateTimeInterface|null
# lastPasswordDate( )

Returns

DateTimeInterface|null

Implementation of

Charcoal\User\UserInterface::lastPasswordDate()
public Charcoal\User\UserInterface
# setLastPasswordIp( integer|string|null $ip )

Parameters

$ip
The last password IP.

Returns

Charcoal\User\UserInterface
Chainable

Throws

InvalidArgumentException
If the IP is not null, an integer or an IP string.

Implementation of

Charcoal\User\UserInterface::setLastPasswordIp()
public string
# lastPasswordIp( )

Get the last password change IP in x.x.x.x format

Get the last password change IP in x.x.x.x format

Returns

string

Implementation of

Charcoal\User\UserInterface::lastPasswordIp()
public Charcoal\User\UserInterface
# setLoginToken( string $token )

Parameters

$token
The login token.

Returns

Charcoal\User\UserInterface
Chainable

Throws

InvalidArgumentException
If the token is not a string.

Implementation of

Charcoal\User\UserInterface::setLoginToken()
public string
# loginToken( )

Returns

string

Implementation of

Charcoal\User\UserInterface::loginToken()
public Charcoal\User\UserInterface
# saveToSession( )

Returns

Charcoal\User\UserInterface
Chainable

Throws

Exception
If trying to save a user to session without a ID.
public boolean
# login( )

Log in the user (in session)

Log in the user (in session)

Called when the authentication is successful.

Returns

boolean
Success / Failure
public boolean
# logLogin( )

Returns

boolean
public
# loginFailed( string $username )

Failed authentication callback

Failed authentication callback

Parameters

$username
The failed username.
public boolean
# logLoginFailed( string $username )

Parameters

$username
The username to log failure.

Returns

boolean
public boolean
# logout( )

Empties the session var associated to the session key.

Empties the session var associated to the session key.

Returns

boolean
Logged out or not.
public Charcoal\User\UserInterface
# resetPassword( string $plainPassword )

Reset the password.

Reset the password.

Encrypt the password and re-save the object in the database. Also updates the last password date & ip.

Parameters

$plainPassword
The plain (non-encrypted) password to reset to.

Returns

Charcoal\User\UserInterface
Chainable

Throws

InvalidArgumentException
If the plain password is not a string.

Implementation of

Charcoal\User\UserInterface::resetPassword()
public static Charcoal\User\UserInterface|null
# getAuthenticated( Charcoal\Factory\FactoryInterface $factory )

Get the currently authenticated user (from session)

Get the currently authenticated user (from session)

Return null if there is no current user in logged into

Parameters

$factory
The factory to create the user object with.

Returns

Charcoal\User\UserInterface|null

Throws

Exception
If the user from session is invalid.
Methods inherited from Charcoal\Object\Content
created(), createdBy(), lastModified(), lastModifiedBy(), modelFactory(), position(), preSave(), preUpdate(), setCreated(), setCreatedBy(), setDependencies(), setLastModified(), setLastModifiedBy(), setModelFactory(), setPosition()
Methods inherited from Charcoal\Object\RevisionableInterface
allRevisions(), createRevisionObject(), generateRevision(), latestRevision(), objectRevisionClass(), revertToRevision(), revisionEnabled(), revisionNum(), setRevisionEnabled()
Methods inherited from Charcoal\User\UserInterface
sessionKey()
Methods used from Charcoal\Object\RevisionableTrait
allRevisions(), createRevisionObject(), generateRevision(), latestRevision(), objectRevisionClass(), revertToRevision(), revisionEnabled(), revisionNum(), setObjectRevisionClass(), setRevisionEnabled()
Properties summary
protected static Charcoal\User\UserInterface $authenticatedUser

$authenticatedUser

$authenticatedUser

#
Properties used from Charcoal\Object\RevisionableTrait
$revisionEnabled
API documentation generated by ApiGen