UserImport
class UserImport
This class handels the import and update of user data
Constants
MODE_UPDATE |
Only updates existing entries |
MODE_INSERT |
Only inserts non existing entries |
MODE_INSERT_UPDATE |
Inserts non existing entries and updates existing ones |
STATUS_ARRAY_VAR |
|
STATUS_NO_EXISTING_USER_ON_UPDATE |
|
STATUS_EXISTING_USER_ON_INSERT |
|
STATUS_USERLIMIT_REACHED |
|
STATUS_FAILURE_DURING_SAVE |
|
STATUS_SKIPPED_NO_LOGIN_IN_DATA |
|
STATUS_SUCCESS |
|
Properties
protected string | $mode | ||
protected bool | $autoGeneratePassword | ||
protected bool | $allowPasswordChange | ||
protected int | $generatedPasswordLength | ||
protected int | $generatedPasswordStrength | ||
protected bool | $autoGenerateLogin | ||
protected bool | $autoGenerateDisplayname | ||
protected string | $uniqueIdentifierField | ||
protected null|callable | $afterPrepareCallback | A callback to further prepare/change the $userData. First parameter is he $userData array and second parameter is the $user object |
|
protected null|callable | $findExistingUserCallback | A callback to find an existing user. $userData is given as first function parameter. |
Methods
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Initialize the import
Callback to further prepare the $userData. USE: function($userData, $userObj); return $userData;
If set to true the password of an EXISTING user will be changed if $userData['password'] is set
If set and $userData['displayname'] is empty, a value for 'displayname' is generated. ("FIRSTNAME LASTANME")
If set and $userData['login'] is empty, a value for 'login' will be generated.
If set to true a password will be autogenerated, if a NEW user has been created and $userData['password'] is empty.
Callback to find a user object. USE: function($userData); return \XELOS\Framework\XF\System\Model\User
Only relevant if autoGeneratePassword is active. See parameters: $XF->lib->sec->generate_pronouncable_password()
Only relevant if autoGeneratePassword is active. See parameters: $XF->lib->sec->generate_pronouncable_password()
Set the import mode. Use class constants: UserImport::MODE_*
Set the unique identifier field for the default findExistingUserCallback. ['id' || 'email' || 'login' || 'meta_*']
Details
at line 617
callable|null
getAfterPrepareCallback()
No description
at line 527
bool
getAllowPasswordChange()
No description
at line 587
bool
getAutoGenerateDisplayname()
No description
at line 572
bool
getAutoGenerateLogin()
No description
at line 512
bool
getAutoGeneratePassword()
No description
at line 632
callable|null
getFindExistingUserCallback()
No description
at line 542
int
getGeneratedPasswordLength()
No description
at line 557
int
getGeneratedPasswordStrength()
No description
at line 491
string
getMode()
No description
at line 602
string
getUniqueIdentifierField()
No description
at line 95
array
import(array $userData)
No description
at line 80
init()
Initialize the import
at line 625
void
setAfterPrepareCallback(callable|null $afterPrepareCallback = null)
Callback to further prepare the $userData. USE: function($userData, $userObj); return $userData;
at line 535
void
setAllowPasswordChange(bool $allowPasswordChange = false)
If set to true the password of an EXISTING user will be changed if $userData['password'] is set
at line 595
void
setAutoGenerateDisplayname(bool $autoGenerateDisplayname = true)
If set and $userData['displayname'] is empty, a value for 'displayname' is generated. ("FIRSTNAME LASTANME")
at line 580
void
setAutoGenerateLogin(bool $autoGenerateLogin = true)
If set and $userData['login'] is empty, a value for 'login' will be generated.
at line 520
void
setAutoGeneratePassword(bool $autoGeneratePassword = true)
If set to true a password will be autogenerated, if a NEW user has been created and $userData['password'] is empty.
at line 640
void
setFindExistingUserCallback(callable $findExistingUserCallback)
Callback to find a user object. USE: function($userData); return \XELOS\Framework\XF\System\Model\User
at line 550
void
setGeneratedPasswordLength(int $generatedPasswordLength = 8)
Only relevant if autoGeneratePassword is active. See parameters: $XF->lib->sec->generate_pronouncable_password()
at line 565
void
setGeneratedPasswordStrength(int $generatedPasswordStrength = 7)
Only relevant if autoGeneratePassword is active. See parameters: $XF->lib->sec->generate_pronouncable_password()
at line 499
void
setMode(string $mode = UserImport::MODE_UPDATE)
Set the import mode. Use class constants: UserImport::MODE_*
at line 610
void
setUniqueIdentifierField(string $uniqueIdentifierField = 'login')
Set the unique identifier field for the default findExistingUserCallback. ['id' || 'email' || 'login' || 'meta_*']