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 615
callable|null
getAfterPrepareCallback()
No description
at line 525
bool
getAllowPasswordChange()
No description
at line 585
bool
getAutoGenerateDisplayname()
No description
at line 570
bool
getAutoGenerateLogin()
No description
at line 510
bool
getAutoGeneratePassword()
No description
at line 630
callable|null
getFindExistingUserCallback()
No description
at line 540
int
getGeneratedPasswordLength()
No description
at line 555
int
getGeneratedPasswordStrength()
No description
at line 489
string
getMode()
No description
at line 600
string
getUniqueIdentifierField()
No description
at line 92
array
import(array $userData)
No description
at line 78
init()
Initialize the import
at line 623
void
setAfterPrepareCallback(callable|null $afterPrepareCallback = null)
Callback to further prepare the $userData. USE: function($userData, $userObj); return $userData;
at line 533
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 593
void
setAutoGenerateDisplayname(bool $autoGenerateDisplayname = true)
If set and $userData['displayname'] is empty, a value for 'displayname' is generated. ("FIRSTNAME LASTANME")
at line 578
void
setAutoGenerateLogin(bool $autoGenerateLogin = true)
If set and $userData['login'] is empty, a value for 'login' will be generated.
at line 518
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 638
void
setFindExistingUserCallback(callable $findExistingUserCallback)
Callback to find a user object. USE: function($userData); return \XELOS\Framework\XF\System\Model\User
at line 548
void
setGeneratedPasswordLength(int $generatedPasswordLength = 8)
Only relevant if autoGeneratePassword is active. See parameters: $XF->lib->sec->generate_pronouncable_password()
at line 563
void
setGeneratedPasswordStrength(int $generatedPasswordStrength = 7)
Only relevant if autoGeneratePassword is active. See parameters: $XF->lib->sec->generate_pronouncable_password()
at line 497
void
setMode(string $mode = UserImport::MODE_UPDATE)
Set the import mode. Use class constants: UserImport::MODE_*
at line 608
void
setUniqueIdentifierField(string $uniqueIdentifierField = 'login')
Set the unique identifier field for the default findExistingUserCallback. ['id' || 'email' || 'login' || 'meta_*']