Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • ActivateOperation
  • AvailableSitesBlock
  • ConfigBlock
  • ConfigOperation
  • DeactivateOperation
  • DeleteBlock
  • DeleteOperation
  • EditBlock
  • Hooks
  • IsUniqueOperation
  • LoginComboElement
  • LoginForm
  • LoginOperation
  • LogoutOperation
  • ManageBlock
  • Model
  • Module
  • OwnershipResolver
  • PermissionResolver
  • ProfileController
  • QueryOperationOperation
  • SaveOperation
  • UnlockLoginOperation
  • Update20131021
  • User
  • ViewProvider

Interfaces

  • OwnershipResolverInterface
  • PermissionResolverInterface

Traits

  • LoggedAtProperty

Exceptions

  • WebsiteAdminNotAccessible

Class User

A user.

ICanBoogie\Object implements ICanBoogie\ToArrayRecursive uses ICanBoogie\ToArrayRecursiveTrait, ICanBoogie\PrototypeTrait
Extended by ICanBoogie\ActiveRecord
Extended by Icybee\Modules\Users\User implements Brickrouge\CSSClassNames uses Brickrouge\CSSClassNamesProperty, ICanBoogie\ActiveRecord\CreatedAtProperty, Icybee\Modules\Users\LoggedAtProperty

Direct known subclasses

Icybee\Modules\Members\Member

Namespace: Icybee\Modules\Users
Located at vendor/icanboogie-modules/users/lib/activerecords/user.php

Methods summary

protected
# get_password( )
protected
# set_password( mixed $password )
protected boolean|null
# get_has_legacy_password_hash( )

Checks if the password hash is a legacy hash, and not a hash created by the password_hash() function.

Checks if the password hash is a legacy hash, and not a hash created by the password_hash() function.

Returns

boolean|null
true if the password hash is a legacy hash, false if the password hash was created by the password_hash() function, and null if the passsword hash is empty.
public
# __construct( string|ICanBoogie\ActiveRecord\Model $model = 'users' )

Defaults $model to "users".

Defaults $model to "users".

Initializes the Icybee\Modules\Users\User::$constructor property with the model identifier if it is not defined.

Parameters

$model
string|ICanBoogie\ActiveRecord\Model
$model

Throws

InvalidArgumentException
if $model is neither a model identifier nor a Icybee\Modules\Users\Model instance.

Overrides

ICanBoogie\ActiveRecord::__construct
public mixed
# __get( string $property )

Returns the value of an inaccessible property.

Returns the value of an inaccessible property.

Multiple callbacks are tried in order to retrieve the value of the property:

  1. get_<property>: Get and return the value of the property.
  2. lazy_get_<property>: Get, set and return the value of the property. Because new

properties are created as public the callback is only called once which is ideal for lazy loading. 3. The prototype is queried for callbacks for the get_<property> and lazy_get_<property> methods. 4. Finally, the ICanBoogie\Object::property event is fired to try and retrieve the value of the property.

Parameters

$property
string
$property

Returns

mixed
The value of the inaccessible property.

Throws

PropertyNotReadable
when the property has a protected or private scope and no suitable callback could be found to retrieve its value.
PropertyNotDefined
when the property is undefined and there is no suitable callback to retrieve its values.

Overrides

ICanBoogie\Object::__get
protected array
# alter_persistent_properties( array $properties, ICanBoogie\ActiveRecord\Model $model )

Unless it's an acceptable value for a column, columns with null values are discarted. This way, we don't have to define every properties before saving our active record.

Unless it's an acceptable value for a column, columns with null values are discarted. This way, we don't have to define every properties before saving our active record.

Parameters

$properties
array
$properties
$model

Returns

array
The altered persistent properties

Overrides

ICanBoogie\ActiveRecord::alter_persistent_properties
public array
# to_array( )

Adds the $logged_at property.

Adds the $logged_at property.

Returns

array

Overrides

ICanBoogie\Object::to_array
protected string
# get_name( )

Returns the formatted name of the user.

Returns the formatted name of the user.

The format of the name is defined by the Icybee\Modules\Users\User::$name_as property. The Icybee\Modules\Users\User::$username, Icybee\Modules\Users\User::$firstname, Icybee\Modules\Users\User::$lastname and Icybee\Modules\Users\User::$nickname properties can be used to format the name.

This is the getter for the $name magic property.

Returns

string
protected Icybee\Modules\Users\Users\Role
# lazy_get_role( )

Returns the role of the user.

Returns the role of the user.

This is the getter for the $role magic property.

Returns

Icybee\Modules\Users\Users\Role
protected array
# lazy_get_roles( )

Returns all the roles associated with the user.

Returns all the roles associated with the user.

This is the getter for the $roles magic property.

Returns

array
protected boolean
# get_is_admin( )

Checks if the user is the admin user.

Checks if the user is the admin user.

This is the getter for the $is_admin magic property.

Returns

boolean
true if the user is the admin user, false otherwise.
protected boolean
# get_is_guest( )

Checks if the user is a guest user.

Checks if the user is a guest user.

This is the getter for the $is_guest magic property.

Returns

boolean
true if the user is a guest user, false otherwise.
protected array
# lazy_get_restricted_sites_ids( )

Returns the ids of the sites the user is restricted to.

Returns the ids of the sites the user is restricted to.

This is the getter for the $restricted_sites_ids magic property.

Returns

array
The array is empty if the user has no site restriction.
public mixed
# has_permission( string|integer $permission, mixed $target = null )

Checks if the user has a given permission.

Checks if the user has a given permission.

Parameters

$permission
string|integer
$permission
$target
mixed
$target

Returns

mixed
public boolean
# has_ownership( mixed $module, mixed $record )

Checks if the user has the ownership of an entry.

Checks if the user has the ownership of an entry.

If the ownership information is missing from the entry (the 'uid' property is null), the user must have the ADMINISTER level to be considered the owner.

Parameters

$module
mixed
$module
$record
mixed
$record

Returns

boolean
public static string
# hash_password( string $password )

Hashes a password.

Hashes a password.

Parameters

$password
string
$password

Returns

string
public boolean
# verify_password( string $password )

Compares a password to the user's password hash.

Compares a password to the user's password hash.

Parameters

$password
string
$password

Returns

boolean
true if the hashed password matches the user's password hash, false otherwise.
public boolean
# login( )

Logs the user in.

Logs the user in.

A user is logged in by setting its id in the application[user_agent] session key.

Note: The method does not checks the user authentication !

The following things happen when the user is logged in:

  • The $core->user property is set to the user.
  • The $core->user_id property is set to the user id.
  • The session id is regenerated and the user id, ip and user agent are stored in the session.

Returns

boolean
true if the login is successful.

Throws

Exception
in attempt to log in a guest user.

See

\Icybee\Modules\Users\Hooks\get_user_id
public
# logout( )

Log the user out.

Log the user out.

The following things happen when the user is logged out:

  • The $core->user property is unset.
  • The $core->user_id property is unset.
  • The $core->session->users['user_id'] property is unset.
protected array[string]mixed
# get_css_class_names( )

Returns the CSS class names of the node.

Returns the CSS class names of the node.

Returns

array[string]mixed

Methods inherited from ICanBoogie\ActiveRecord

__sleep(), delete(), get_model(), get_model_id(), save()

Methods inherited from ICanBoogie\Object

from(), resolve_facade_properties(), resolve_private_properties(), to_json()

Methods inherited from ICanBoogie\ToArrayRecursive

to_array_recursive()

Methods inherited from Brickrouge\CSSClassNames

css_class()

Methods used from Brickrouge\CSSClassNamesProperty

css_class(), get_css_class()

Methods used from ICanBoogie\ActiveRecord\CreatedAtProperty

get_created_at(), set_created_at()

Methods used from Icybee\Modules\Users\LoggedAtProperty

get_logged_at(), set_logged_at()

Methods used from ICanBoogie\ToArrayRecursiveTrait

to_array_recursive()

Methods used from ICanBoogie\PrototypeTrait

__call(), __set(), __wakeup(), get_prototype(), has_method(), has_property(), last_chance_get(), last_chance_set()

Magic methods summary

Constants summary

string UID 'uid'
#
string EMAIL 'email'
#
string PASSWORD 'password'
#
string PASSWORD_HASH 'password_hash'
#
string USERNAME 'username'
#
string FIRSTNAME 'firstname'
#
string LASTNAME 'lastname'
#
string NICKNAME 'nickname'
#
string CREATED_AT 'created_at'
#
string LOGGED_AT 'logged_at'
#
string CONSTRUCTOR 'constructor'
#
string LANGUAGE 'language'
#
string TIMEZONE 'timezone'
#
string IS_ACTIVATED 'is_activated'
#
string ROLES 'roles'
#
string RESTRICTED_SITES 'restricted_sites'
#
string NAME_AS 'name_as'
#
integer NAME_AS_USERNAME 0
#

The $name property should be created from $username.

The $name property should be created from $username.

integer NAME_AS_FIRSTNAME 1
#

The $name property should be created from $firstname.

The $name property should be created from $firstname.

integer NAME_AS_LASTNAME 2
#

The $name property should be created from $lastname.

The $name property should be created from $lastname.

integer NAME_AS_FIRSTNAME_LASTNAME 3
#

The $name property should be created from $firstname $lastname.

The $name property should be created from $firstname $lastname.

integer NAME_AS_LASTNAME_FIRSTNAME 4
#

The $name property should be created from $lastname $firstname.

The $name property should be created from $lastname $firstname.

integer NAME_AS_NICKNAME 5
#

The $name property should be created from $nickname.

The $name property should be created from $nickname.

Properties summary

public string $uid
#

User identifier.

User identifier.

public string $constructor
#

Constructor of the user record (module id).

Constructor of the user record (module id).

The property MUST be defined to persist the record.

public string $email
#

User email.

User email.

The property MUST be defined to persist the record.

protected string $password
#

User password.

User password.

The property is only used to update the Icybee\Modules\Users\User::$password_hash property when the record is saved.

protected string $password_hash
#

User password hash.

User password hash.

Note: The property MUST NOT be private, otherwise only instances of the class can be initialized with a value, for subclasses instances the property would be null.

public string $username
#

Username of the user.

Username of the user.

The property MUST be defined to persist the record.

public string $firstname
#

First name of the user.

First name of the user.

public string $lastname
#

Last name of the user.

Last name of the user.

public string $nickname
#

Nickname of the user.

Nickname of the user.

public string $name_as
#

Prefered format to create the value of the $name property.

Prefered format to create the value of the $name property.

public string $language
#

Prefered language of the user.

Prefered language of the user.

public string $timezone
#

Prefered timezone of the user.

Prefered timezone of the user.

public boolean $is_activated
#

State of the user account activation.

State of the user account activation.

Properties inherited from ICanBoogie\ActiveRecord

$model_id

Magic properties

public ICanBoogie\DateTime $logged_at
#

The date and time at which the user was logged.

The date and time at which the user was logged.

public read-only string $name
#

The formatted name of the user.

The formatted name of the user.

public read-only boolean $is_admin
#

true if the user is admin, false otherwise.

true if the user is admin, false otherwise.

public read-only boolean $is_guest
#

true if the user is a guest, false otherwise.

true if the user is a guest, false otherwise.

public read-only Icybee\Modules\Users\Users\Role $role
#
public read-only string $password_hash
#

The password hash.

The password hash.

public read-only boolean|null $has_legacy_password_hash
#

Whether the password hash is a legacy hash. Icybee\Modules\Users\User::get_has_legacy_password_hash().

Whether the password hash is a legacy hash. Icybee\Modules\Users\User::get_has_legacy_password_hash().

Magic properties inherited from ICanBoogie\ActiveRecord

$model, $model_id

Magic properties inherited from ICanBoogie\Object

$prototype

Magic properties used from Brickrouge\CSSClassNamesProperty

$css_class

Autodoc API documentation generated by ApiGen 2.8.0