Helper class for account management

package midcom

 Methods

__construct (\midcom_db_person $person)

Parameters

$person

add_username_constraint (\midcom_core_query $query, string $operator, string $value)

Modify a query instance for searching by username, with differences between mgd1 and mgd2 abstracted away
Static

Parameters

$query

\midcom_core_query&$query The QB or MC instance to work on

$operator

stringThe operator for the username constraint

$value

stringThe value for the username constraint

add_username_order (\midcom_core_query $query, string $direction)

Add username order to a query instance, with differences between mgd1 and mgd2 abstracted away.
Static

Note that it actually does nothing under mgd2 right now, because it's still unclear how this could be implemented

Parameters

$query

\midcom_core_query&$query The QB or MC instance to work on

$direction

stringThe value for the username constraint

delete ()

Deletes the current user account.

This will cleanup all information associated with the user that is managed by the core (like login sessions and privilege records).

This call requires the delete privilege on the person object, this is enforced using require_do.

Returns

booleanIndicating success.

get ($person)

Static

Parameters

$person

get_password ()

get_username ()

save ()

set_password (string $password, boolean $encode)

Set the account's password

Parameters

$password

stringThe password to set

$encode

booleanShould the password be encoded according to the configured auth type

set_username ($username)

Parameters

$username

_create_user ()

_get_user ()

_is_username_unique ()

_update ()

 Properties

 

array $_instances

Currently open accounts
param
 

boolean $_midgard2

Flag to tell us whether we run under midgard2 or not
param
 

string $_new_password

Change tracking variables
 

mixed $_old_password

 

mixed $_old_username

 

\midcom_db_person $_person

The person the account belongs to
param
 

object $_user

The current account
param