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:
Methods
Calls constructor in base class.
__construct(array $aCfg, $oDb, $sUserId) : \ConUser
Checks given values and initializes class.
Parameters
$aCfg
array
$oDb
$sUserId
Exceptions
Returns
Following configuration values are recognized:
$this->aCfg['password']['check_password_mask'], bool
En- or disable these checks...
checkPasswordMask(string $sNewPassword) : int
$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)
Parameters
$sNewPassword
string
Returns
int
This 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.
checkPasswordStrength(string $sNewPassword) : int
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.
Parameters
$sNewPassword
string
Returns
int
{@see iConUser::encodePassword()}
encodePassword(string $sPassword) : string
Parameters
$sPassword
string
Returns
string
Generates new user id based on current user name.
generateUserId() : string
Inherited
inherited_from |
\ConUser_Abstract::generateUserId() |
Returns
string
Getter method to get user adress data
getAddressData() : string
Returns
string
Realname of user
This static method provides a simple way to get error messages depending
on error code $iErrorCode, which is returned by checkPassword* methods.
getErrorString(int $iErrorCode, array $aCfg) : string
Parameters
$iErrorCode
int
$aCfg
array
Contenido configuration array
Returns
string
Getter method to get user mail
getMail() : string
Returns
string
Realname of user
Getter method to get user perm name
getPerms() : string
Returns
string
Realname of user
Getter method to get user realname
getRealName() : string
Returns
string
Realname of user
Getter method to get user tel number
getTelNumber() : string
Returns
string
Realname of user
Getter method to get user wysi
getUseTiny() : string
Returns
string
Realname of user
Returns user id, currently set.
getUserId() : string
Inherited
inherited_from |
\ConUser_Abstract::getUserId() |
Returns
string
Returns user name, currently set
getUserName() : string
Inherited
inherited_from |
\ConUser_Abstract::getUserName() |
Returns
string
Getter method to get user valid date from-to
getValidDateFrom() : string
Returns
string
Realname of user
Getter method to get user valid date from-to
getValidDateTo() : string
Returns
string
Realname of user
Currently not implemented!
load(string $sUserId) : boolean
see |
\ConUser_Abstract::load() |
todo |
implement it |
Parameters
$sUserId
string
Returns
boolean
This method tries to save all information collected for an user.
save() : boolean
If everything is fine, it returns true - otherwise false. On fatal
errors a ConUserException will be thrown.
see |
\ConUser_Abstract::save() |
Returns
boolean
This 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.
savePassword(string $sNewPassword) : int
Use the PASS_* constants to check what happens.
see |
\ConUser_Abstract::savePassword() |
Parameters
$sNewPassword
string
Password to set
Exceptions
Returns
int
This function does update without password column to all columns of con_phplib_auth_user_md5 table.
saveUser() : void
Setter method to set Adress Data
setAddressData($sAddressStreet, $sAddressCity, $sAddressZip, $sAddressCountry) : void
Parameters
$sAddressStreet
$sAddressCity
$sAddressZip
$sAddressCountry
Sets value for city.
setCity(string $sCity)
Sets value for country.
setCountry(string $sCountry)
Parameters
$sCountry
string
Setter method to set user mail address
setMail($sMail) : void
Checks password which has to be set and return PASS_* values (i.e.
setPassword(string $sPassword) : int
Inherited
on success PASS_OK).
inherited_from |
\ConUser_Abstract::setPassword() |
Parameters
$sPassword
string
Returns
int
setter method to set
setPerms($aPerms) : void
Setter method to set user real name
setRealName($sRealName) : void
Sets value for street.
setStreet(string $sStreet)
Parameters
$sStreet
string
setter method to set user tel number
setTelNumber($sTelNumber) : void
Setter method to set
setUseTiny($iUseTiny) : void
Sets user ID.
setUserId(\unknown_type $sUserId)
Inherited
inherited_from |
\ConUser_Abstract::setUserId() |
Parameters
$sUserId
\unknown_type
TODO check this
Sets up new user name.
setUserName(string $sUserName)
Inherited
inherited_from |
\ConUser_Abstract::setUserName() |
Parameters
$sUserName
string
setter method to set
setValidDateFrom($sValidateFrom) : void
Parameters
$sValidateFrom
setter method to set User
setValidDateTo($sValidateTo) : void
Sets value for ZIP.
setZip(string $sZip)
Checks if an user with user id $sUserId already exists in DB.
userExists($sUserId) : boolean
Parameters
$sUserId
Returns
boolean
Checks if username $sUsername is already in use.
usernameExists(string $sUsername) : boolean
Parameters
$sUsername
string
Returns
boolean
Returns (unencoded!) password. This method should never be public
available!
getPassword() : string
Inherited
inherited_from |
\ConUser_Abstract::getPassword() |
Returns
string
Creates new user.
insert() : boolean
This method creates a new user with base informations. It is called
within the iConUser::save() method.
Returns
boolean
Updates a user
update() : boolean
This method update base user informations in user table. It is called
within the iConUser::save() method.
Returns
boolean
Properties
Contenido configuration array
$aCfg : array
Inherited
inherited_from |
\ConUser_Abstract::$$aCfg |
Referemces database abstraction instance
$oDb : \DB_Contenido
Inherited
inherited_from |
\ConUser_Abstract::$$oDb |
Array of address data fill like below values
$aAddress : array
$aAddress['street'], $aAddress['city'], $aAddress['country'], $aAddress['zip']
To Use Tiny Editor
$iUseTiny : int
Mail address
$sMail : string
Holds the password which should be set.
$sPassword : \unknown_type
Inherited
inherited_from |
\ConUser_Abstract::$$sPassword |
Permname
$sPermName : string
Realname
$sRealName : string
Telephone number
$sTelNumber : string
current User ID
$sUserId : string
Inherited
inherited_from |
\ConUser_Abstract::$$sUserId |
Login name of current user.
$sUserName : string
Inherited
inherited_from |
\ConUser_Abstract::$$sUserName |
User valid date from
$sValidDateFrom : string
User valid date to
$sValidDateTo : string
Constants
Exception code, which is used if an password is set to save
that is not valid.
EXCEPTION_PASSWORD_INVALID : int
Inherited
final |
|
inherited_from |
\iConUser::EXCEPTION_PASSWORD_INVALID |
inherited_from |
\ConUser_Abstract::EXCEPTION_PASSWORD_INVALID |
Exception code, which is used if you try to add an user
that already exists.
EXCEPTION_USERNAME_EXISTS : int
Inherited
final |
|
inherited_from |
\iConUser::EXCEPTION_USERNAME_EXISTS |
inherited_from |
\ConUser_Abstract::EXCEPTION_USERNAME_EXISTS |
This value will be used if no minimum length
for passwords are set via $cfg['password']['min_length']
MIN_PASS_LENGTH_DEFAULT
Inherited
inherited_from |
\iConUser::MIN_PASS_LENGTH_DEFAULT |
inherited_from |
\ConUser_Abstract::MIN_PASS_LENGTH_DEFAULT |
Given password is not complex enough
PASS_NOT_COMPLEX : int
Inherited
final |
|
inherited_from |
\iConUser::PASS_NOT_COMPLEX |
inherited_from |
\ConUser_Abstract::PASS_NOT_COMPLEX |
Password does not contain enough different characters.
PASS_NOT_ENOUGH_DIFFERENT_CHARS : int
Inherited
final |
|
inherited_from |
\iConUser::PASS_NOT_ENOUGH_DIFFERENT_CHARS |
inherited_from |
\ConUser_Abstract::PASS_NOT_ENOUGH_DIFFERENT_CHARS |
Password does not contain enough mixed characters.
PASS_NOT_ENOUGH_MIXED_CHARS : int
Inherited
final |
|
inherited_from |
\iConUser::PASS_NOT_ENOUGH_MIXED_CHARS |
inherited_from |
\ConUser_Abstract::PASS_NOT_ENOUGH_MIXED_CHARS |
Password does not contain enough numbers.
PASS_NOT_ENOUGH_NUMBERS : int
Inherited
final |
|
inherited_from |
\iConUser::PASS_NOT_ENOUGH_NUMBERS |
inherited_from |
\ConUser_Abstract::PASS_NOT_ENOUGH_NUMBERS |
Password does not contain enough symbols.
PASS_NOT_ENOUGH_SYMBOLS : int
Inherited
final |
|
inherited_from |
\iConUser::PASS_NOT_ENOUGH_SYMBOLS |
inherited_from |
\ConUser_Abstract::PASS_NOT_ENOUGH_SYMBOLS |
Given password is not strong enough
PASS_NOT_STRONG : int
Inherited
final |
|
inherited_from |
\iConUser::PASS_NOT_STRONG |
inherited_from |
\ConUser_Abstract::PASS_NOT_STRONG |
Password is ok and stored.
PASS_OK : int
Inherited
final |
|
inherited_from |
\iConUser::PASS_OK |
inherited_from |
\ConUser_Abstract::PASS_OK |
Given password is to short
PASS_TO_SHORT : int
Inherited
final |
|
inherited_from |
\iConUser::PASS_TO_SHORT |
inherited_from |
\ConUser_Abstract::PASS_TO_SHORT |