contenido\classes\class.conuser.php
Description: This class will be a replacement for all other user classes, which encapsulates only small parts of user related tasks.
In current version you can administer optional password checks via following configuration values:
En- or disabling checks: $cfg['password']['check_password_mask'] = [true|false] Use this flag to enable (true) or disable (false) the mask checks.
$cfg['password']['use_cracklib'] = [true|false] Use this to enable (true) or disable (false) the strength check, currently done with cracklib.
Mask checks: Password mask checks are checks belonging to the "format" of the needed password string.
$cfg['password']['min_length'], int Minimum length a password has to have. If not set, 8 chars are set as default $cfg['password']['numbers_mandatory'], int If set to a value greater than 0, at least $cfg['password']['numbers_mandatory'] numbers must be in password $cfg['password']['symbols_mandatory'], int && $cfg['password']['symbols_regex'], String If 'symbols_mandatory' set to a value greater than 0, at least so many symbols has to appear in given password. What symbols are regcognized can be administrated via 'symbols_regex'. This has to be a regular expression which is used to "find" the symbols in $sNewPassword. If not set, following RegEx is used: "/[|!@#$%&*\/=?,;.:-_+~^�\]/" $cfg['password']['mixed_case_mandatory'], int If set to a value greater than 0 so many lower and upper case character must appear in the password. (e.g.: if set to 2, 2 upper and 2 lower case characters must appear)
Strength check Passwords should have some special characteristics to be a strong, i.e. not easy to guess, password. Currently cracklib is supported. These are the configuration possibilities:
$cfg['password']['cracklib_dict'], string Path and file name (without file extension!) to dictionary you want to use. This setting is mandatory!
Keep in mind that these type of check only works if crack module is available.
- Author
- Bilal Arslan, Holger Librenz
- Copyright
- four for business AG {@internal created 04.11.2008 modified 2008-11-16, H. Librenz - added structure, comments fixed, code debugged modified 2008-11-21, H. Librenz - some documentation stuff added modified 2008-11-25, Timo Trautman - removed not existing include modified 2008-12-04, Bilal Arslan, Bugfixed for set passwort length, comments "how to use" fixed. Bugfixed for password, lower Case Upper case count, for symbols count and numbers count. modified 2008-12-04, Timo Trautman, Added Contenido $cfg as param for getErrorString() modified 2011-02-26, Ortwin Pinke, added unset for pw-request-marker, changed header svn-id and version declaration $Id:$ }}
- Package
- Contenido Backend classes
- Subpackage
- Backend User
- Version
- 1.4.0
\ConUser
Description: Class User to handle all user related task. In first implementations, it will only do some little things, like checking and setting passwords.
Requirements:
- Parent(s)
- \ConUser_Abstract
- Author
- Bilal Arslan, Holger Librenz
- Con_php_req
- 5.0
- Copyright
- four for business AG
- License
- http://www.contenido.org/license/LIZENZ.txt
- Link
- http://www.4fb.de
- Link
- http://www.contenido.org
- Since
- file available since contenido release => 4.8.8
- Version
- 0.2.0
Constants
int
PASS_TO_SHORT
= 1- Final
- Inherited_from
- \iConUser::PASS_TO_SHORT
- Inherited_from
- \ConUser_Abstract::PASS_TO_SHORT
- int
int
PASS_NOT_STRONG
= 2- Final
- Inherited_from
- \iConUser::PASS_NOT_STRONG
- Inherited_from
- \ConUser_Abstract::PASS_NOT_STRONG
- int
int
PASS_NOT_COMPLEX
= 3- Final
- Inherited_from
- \iConUser::PASS_NOT_COMPLEX
- Inherited_from
- \ConUser_Abstract::PASS_NOT_COMPLEX
- int
int
PASS_NOT_ENOUGH_NUMBERS
= 4- Final
- Inherited_from
- \iConUser::PASS_NOT_ENOUGH_NUMBERS
- Inherited_from
- \ConUser_Abstract::PASS_NOT_ENOUGH_NUMBERS
- int
int
PASS_NOT_ENOUGH_SYMBOLS
= 5- Final
- Inherited_from
- \iConUser::PASS_NOT_ENOUGH_SYMBOLS
- Inherited_from
- \ConUser_Abstract::PASS_NOT_ENOUGH_SYMBOLS
- int
int
PASS_NOT_ENOUGH_MIXED_CHARS
= 6- Final
- Inherited_from
- \iConUser::PASS_NOT_ENOUGH_MIXED_CHARS
- Inherited_from
- \ConUser_Abstract::PASS_NOT_ENOUGH_MIXED_CHARS
- int
int
PASS_NOT_ENOUGH_DIFFERENT_CHARS
= 7- Final
- Inherited_from
- \iConUser::PASS_NOT_ENOUGH_DIFFERENT_CHARS
- Inherited_from
- \ConUser_Abstract::PASS_NOT_ENOUGH_DIFFERENT_CHARS
- int
int
EXCEPTION_USERNAME_EXISTS
= 8- Final
- Inherited_from
- \iConUser::EXCEPTION_USERNAME_EXISTS
- Inherited_from
- \ConUser_Abstract::EXCEPTION_USERNAME_EXISTS
- int
int
EXCEPTION_PASSWORD_INVALID
= 9- Final
- Inherited_from
- \iConUser::EXCEPTION_PASSWORD_INVALID
- Inherited_from
- \ConUser_Abstract::EXCEPTION_PASSWORD_INVALID
- int
MIN_PASS_LENGTH_DEFAULT
= 8- Inherited_from
- \iConUser::MIN_PASS_LENGTH_DEFAULT
- Inherited_from
- \ConUser_Abstract::MIN_PASS_LENGTH_DEFAULT
Properties

array $aAddress = array()$aAddress['street'], $aAddress['city'], $aAddress['country'], $aAddress['zip']
array()Details- Type
- array

\DB_Contenido $oDb = nullnullDetails- Type
- \DB_Contenido
- Inherited_from
- \ConUser_Abstract::$$oDb

\unknown_type $sPassword = nullnullDetails- Type
- \unknown_type
- Inherited_from
- \ConUser_Abstract::$$sPassword

string $sUserName = nullnullDetails- Type
- string
- Inherited_from
- \ConUser_Abstract::$$sUserName
Methods

__construct(array $aCfg, $oDb = null, $sUserId = null) : \ConUserCalls constructor in base class.
Checks given values and initializes class.
| Name | Type | Description |
|---|---|---|
| $aCfg | array | |
| $oDb | ||
| $sUserId |
| Type | Description |
|---|---|
| \ConUser |
| Exception | Description |
|---|---|
| \ConUserException |

checkPasswordMask(string $sNewPassword) : intFollowing configuration values are recognized: $this->aCfg['password']['check_password_mask'], bool En- or disable these checks.
.. $this->aCfg['password']['min_length'], int Minimum length a password has to have. If not set, 8 chars are set as default $this->aCfg['password']['numbers_mandatory'], int If set to a value greater than 0, at least $this->aCfg['password']['numbers_mandatory'] numbers must be in password $this->aCfg['password']['symbols_mandatory'], int && $this->aCfg['password']['symbols_regex'], String If 'symbols_mandatory' set to a value greater than 0, at least so many symbols has to appear in given password. What symbols are regcognized can be administrated via 'symbols_regex'. This has to be a regular expression which is used to "find" the symbols in $sNewPassword. If not set, following RegEx is used: "/[|!@#$%&*\/=?,;.:-_+~^�\]/" $this->aCfg['password']['mixed_case_mandatory'], int If set to a value greater than 0 so many lower and upper case character must appear in the password. (e.g.: if set to 2, 2 upper and 2 lower case characters must appear)
| Name | Type | Description |
|---|---|---|
| $sNewPassword | string |
| Type | Description |
|---|---|
| int |

checkPasswordStrength(string $sNewPassword) : intThis password checks the password strength.
In "standard" implementation, it uses cracklib, if administrated and available. Other possible checks are checks against user list with birth dates or similar, non direct "maskable" checks.
Following configuration values are recognized: $this->aCfg['password']['use_cracklib'], bool En- or disable these checks... $this->aCfg['password']['cracklib_dict'], string Path and file name (without file extension!) to dictionary you want to use. This setting is mandatory!
Please ensure that you have a working crack module installed. If the function crack_opendict is not available, the check are omitted and the result is iConUser::PASS_OK.
| Name | Type | Description |
|---|---|---|
| $sNewPassword | string |
| Type | Description |
|---|---|
| int |

encodePassword(string $sPassword) : string{@see iConUser::encodePassword()}
You should use one-way encodings or hash-algorithms to ensure that nobody can read simply the passwords!
| Name | Type | Description |
|---|---|---|
| $sPassword | string |
| Type | Description |
|---|---|
| string |

generateUserId() : stringGenerates new user id based on current user name.
Inherited from: \ConUser_Abstract::generateUserId()| Type | Description |
|---|---|
| string |

getAddressData() : stringGetter method to get user adress data
| Type | Description |
|---|---|
| string | Realname of user |

getErrorString(int $iErrorCode, array $aCfg) : stringThis static method provides a simple way to get error messages depending on error code $iErrorCode, which is returned by checkPassword* methods.
| Name | Type | Description |
|---|---|---|
| $iErrorCode | int | |
| $aCfg | array | Contenido configuration array |
| Type | Description |
|---|---|
| string |

getRealName() : stringGetter method to get user realname
| Type | Description |
|---|---|
| string | Realname of user |

getTelNumber() : stringGetter method to get user tel number
| Type | Description |
|---|---|
| string | Realname of user |

getValidDateFrom() : stringGetter method to get user valid date from-to
| Type | Description |
|---|---|
| string | Realname of user |

getValidDateTo() : stringGetter method to get user valid date from-to
| Type | Description |
|---|---|
| string | Realname of user |

insert() : booleanCreates new user.
This method creates a new user with base informations. It is called within the iConUser::save() method.
| Type | Description |
|---|---|
| boolean |
- Todo
- add value checks!

load(string $sUserId) : booleanCurrently not implemented!
| Name | Type | Description |
|---|---|---|
| $sUserId | string |
| Type | Description |
|---|---|
| boolean |
- See
- \ConUser_Abstract::load()
- Todo
- implement it

save() : booleanThis method tries to save all information collected for an user.
If everything is fine, it returns true - otherwise false. On fatal errors a ConUserException will be thrown.
| Type | Description |
|---|---|
| boolean |

savePassword(string $sNewPassword) : intThis method saves the given password $sNewPassword.
The password has to be checked, before it is set to the database. The resulting integer value represents the result code. Use the PASS_* constants to check what happens.
| Name | Type | Description |
|---|---|---|
| $sNewPassword | string | Password to set |
| Type | Description |
|---|---|
| int |
| Exception | Description |
|---|---|
| \ConUserException |

saveUser() : voidThis function does update without password column to all columns of con_phplib_auth_user_md5 table.

setAddressData( $sAddressStreet, $sAddressCity, $sAddressZip, $sAddressCountry) : voidSetter method to set Adress Data
| Name | Type | Description |
|---|---|---|
| $sAddressStreet | ||
| $sAddressCity | ||
| $sAddressZip | ||
| $sAddressCountry |

setCountry(string $sCountry) : voidSets value for country.
| Name | Type | Description |
|---|---|---|
| $sCountry | string |

setPassword(string $sPassword) : intChecks password which has to be set and return PASS_* values (i.e.
Inherited from: \ConUser_Abstract::setPassword()on success PASS_OK).
| Name | Type | Description |
|---|---|---|
| $sPassword | string |
| Type | Description |
|---|---|
| int |

setRealName( $sRealName) : voidSetter method to set user real name
| Name | Type | Description |
|---|---|---|
| $sRealName |

setTelNumber( $sTelNumber) : voidsetter method to set user tel number
| Name | Type | Description |
|---|---|---|
| $sTelNumber |

setUserId(\unknown_type $sUserId) : void| Name | Type | Description |
|---|---|---|
| $sUserId | \unknown_type | TODO check this |

setValidDateFrom( $sValidateFrom) : voidsetter method to set
| Name | Type | Description |
|---|---|---|
| $sValidateFrom |

setValidDateTo( $sValidateTo) : voidsetter method to set User
| Name | Type | Description |
|---|---|---|
| $sValidateTo |

update() : booleanUpdates a user
This method update base user informations in user table. It is called within the iConUser::save() method.
| Type | Description |
|---|---|
| boolean |
- Todo
- add type checks!

userExists( $sUserId) : booleanChecks if an user with user id $sUserId already exists in DB.
| Name | Type | Description |
|---|---|---|
| $sUserId |
| Type | Description |
|---|---|
| boolean |