\org_openpsa_user_accounthelper

Helper class for creating a new account for an existing person

Note, that the request data, for ease of use, already contains the L10n Databases of the Component and MidCOM itself located in this class. They are stored as 'l10n' and 'l10n_midcom'. Also available as 'config' is the current component configuration.

Summary

Methods
Properties
Constants
__construct()
__get()
__isset()
set_active_leaf()
add_stylesheet()
get_workflow()
create_account()
set_account()
generate_password()
generate_safe_password()
check_password_reuse()
check_password_strength()
check_password_age()
disable_account()
delete_account()
close_account()
reopen_account()
is_blocked()
get_person_by_formdata()
check_login_attempts()
$_component
$errstr
$_i18n
$_l10n
$_l10n_midcom
$_config
No constants found
_save_old_password()
_get_old_passwords()
_check_repetition()
$_person
$_account
N/A
_get_account()
$_services
N/A

Properties

$_component

$_component : string

The name of the component, e.g. net.nehmer.static. Should be used whenever the component's name is required instead of hardcoding it.

Type

string

$errstr

$errstr : 

Type

$_i18n

$_i18n : \midcom_services_i18n

A handle to the i18n service.

Type

\midcom_services_i18n

$_l10n

$_l10n : \midcom_services_i18n_l10n

The components' L10n string database.

Type

\midcom_services_i18n_l10n

$_l10n_midcom

$_l10n_midcom : \midcom_services_i18n_l10n

The global MidCOM string database.

Type

\midcom_services_i18n_l10n

$_config

$_config : \midcom_helper_configuration

The current configuration.

Type

\midcom_helper_configuration

$_person

$_person : \midcom_db_person

The person we're working on

Type

\midcom_db_person

$_services

$_services : array

Array that holds the already instantiated services

Type

array

Methods

__construct()

__construct(\midcom_db_person  $person = null) 

Parameters

\midcom_db_person $person

__get()

__get(  $field) 

Parameters

$field

__isset()

__isset(  $field) 

Parameters

$field

set_active_leaf()

set_active_leaf(  $leaf_id) 

Parameters

$leaf_id

add_stylesheet()

add_stylesheet(string  $url, string  $media = false) 

Convenience shortcut for adding CSS files

Parameters

string $url

The stylesheet URL

string $media

The media type(s) for the stylesheet, if any

get_workflow()

get_workflow(string  $identifier, array  $options = array()) : \midcom\workflow\dialog

Parameters

string $identifier
array $options

Returns

\midcom\workflow\dialog

create_account()

create_account(  $person_guid,   $username,   $usermail,   $password = "",   $send_welcome_mail = false) 

can be called by various handlers

Parameters

$person_guid
$username
$usermail
$password
$send_welcome_mail

set_account()

set_account(string  $username, string  $new_password) 

Sets username and password for person

Parameters

string $username

Contains username

string $new_password

Contains the new password to set

generate_password()

generate_password(integer  $length) : string

Returns an auto generated password of variable length

Parameters

integer $length

The number of chars the password will contain

Returns

string —

The generated password

generate_safe_password()

generate_safe_password(integer  $length) : string

Returns an auto generated password which will pass the persons check_password_strength test

Parameters

integer $length

The number of chars the password will contain

Returns

string —

The generated password

check_password_reuse()

check_password_reuse(string  $password,   $show_ui_message = false) : boolean

Function to check if passed password was already used

Parameters

string $password

Password to check

$show_ui_message

Returns

boolean —

returns true if password wasn't used already

check_password_strength()

check_password_strength(string  $password,   $show_ui_message = false) 

Function to check strength of passed password

Parameters

string $password

Contains password to check

$show_ui_message

check_password_age()

check_password_age() : boolean

Function to check password age for this user (age is taken from config)

Returns

boolean —
  • true indicates password is ok - false password is to old

disable_account()

disable_account() : boolean

Function to disable account for time period given in config

Returns

boolean —
  • indicates success

delete_account()

delete_account() : boolean

Function to delete account

Returns

boolean —

indicates success

close_account()

close_account() : boolean

Permanently disable an user account

Returns

boolean —
  • indicates success

reopen_account()

reopen_account() 

Reopen a blocked account.

This will fail if someone set a new password on the account while it was blocked

is_blocked()

is_blocked() 

Determine if an account is blocked

get_person_by_formdata()

get_person_by_formdata(  $data) 

Parameters

$data

check_login_attempts()

check_login_attempts(string  $component = null) : boolean

Record failed login attempts and disable account is necessary

Parameters

string $component

the component we take the config values from

Returns

boolean —

True if further login attempts are allowed, false otherwise

_save_old_password()

_save_old_password() 

Function to add current password to parameter old passwords - does not update()

_get_old_passwords()

_get_old_passwords() : array

Function get old passwords

Returns

array —
  • Array with old passwords - empty if there aren't any old passwords

_check_repetition()

_check_repetition(integer  $plen, string  $password) : string

Function to check repetition for given password

Parameters

integer $plen

length to check for repetitions inside the password

string $password

contains password to check

Returns

string —
  • string without repetitions

_get_account()

_get_account()