Class ilServicesUserTasks.
More...
◆ createAnonymousUsers()
static ilServicesUserTasks::createAnonymousUsers |
( |
|
$context, |
|
|
|
$params |
|
) |
| |
|
static |
- Parameters
-
- Returns
- array
Definition at line 25 of file class.ilServicesUserTasks.php.
References $params, and array.
33 $pseudonymousUserMap =
array();
34 $discloseMap =
array();
37 foreach($input_params[
'usrIdList'] as $user_id)
39 $source_user =
new ilObjUser($user_id,
false);
40 $anon_login = self::getValidLogin();
41 $anon_password = self::generatePassword();
42 $new_id = self::createUser(
45 $source_user->getEmail()
48 $pseudonymousUserMap[] =
array(
49 'Original User' => $user_id,
50 'Anonymous User' => $new_id
53 $discloseMap[] =
array(
54 'Original User' => $user_id,
55 'Original Login' => $source_user->getLogin(),
56 'Original Firstname' => $source_user->getFirstname(),
57 'Original Lastname' => $source_user->getLastname(),
58 'Original Matriculation' => $source_user->getMatriculation(),
59 'Original Gender' => $source_user->getGender(),
60 'Original EMail' => $source_user->getEmail(),
61 'Anon User' => $new_id,
62 'Anon Login' => $anon_login,
63 'Anon Password' => $anon_password
66 $usrIdList[] = $new_id;
69 return array($output_params[0] => $discloseMap);
Create styles array
The data for the language used.
◆ createUser()
static ilServicesUserTasks::createUser |
( |
|
$login, |
|
|
|
$password, |
|
|
|
$email |
|
) |
| |
|
staticprotected |
- Parameters
-
string | $login | |
string | $password | |
string | $email | |
- Returns
- int
Definition at line 111 of file class.ilServicesUserTasks.php.
References $DIC, and IL_PASSWD_PLAIN.
114 $rbacadmin = $DIC[
'rbacadmin'];
117 $user->setTimeLimitUnlimited(TRUE);
118 $user->setFirstname(self::ANON_FIRSTNAME);
119 $user->setLastname(self::ANON_LASTNAME);
120 $user->setEmail($email);
121 $user->setGender(self::ANON_GENDER);
123 $user->setLogin($login);
124 $user->setActive(
true, 6);
127 $user->setLastPasswordChangeTS(0);
130 $user->setPref(
'send_info_mails',
'n');
133 $rbacadmin->assignUser(4, $user->getId(),
true);
135 return $user->getId();
◆ generatePassword()
static ilServicesUserTasks::generatePassword |
( |
|
$length = 8 | ) |
|
|
staticprotected |
- Parameters
-
- Returns
- string
Definition at line 90 of file class.ilServicesUserTasks.php.
References array.
93 $setLength = strlen(self::PASSWORD_CHARACTERSET) - 1;
95 for ($i = 0; $i < $length; $i++)
97 $index = rand(0, $setLength);
98 $password[] = self::PASSWORD_CHARACTERSET[$index];
101 return implode($password);
Create styles array
The data for the language used.
◆ getValidLogin()
static ilServicesUserTasks::getValidLogin |
( |
| ) |
|
|
staticprotected |
- Returns
- string
Definition at line 75 of file class.ilServicesUserTasks.php.
References ilObjUser\_loginExists().
79 $login = self::ANON_LOGIN_PREFIX.str_pad(rand(0,9999999),7,STR_PAD_LEFT);
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
◆ repersonalizeUsers()
static ilServicesUserTasks::repersonalizeUsers |
( |
|
$context, |
|
|
|
$params |
|
) |
| |
|
static |
- Parameters
-
Definition at line 142 of file class.ilServicesUserTasks.php.
References $params.
148 foreach($input_params[
'discloseMap'] as $disclose_entry)
150 $anon_user =
new ilObjUser($disclose_entry[
'Anon User'],
false);
151 $anon_user->setFirstname($disclose_entry[
'Original Firstname']);
152 $anon_user->setLastname($disclose_entry[
'Original Lastname']);
153 $anon_user->setMatriculation($disclose_entry[
'Original Matriculation']);
154 $anon_user->setGender($disclose_entry[
'Original Gender']);
155 $anon_user->update();
◆ ANON_FIRSTNAME
const ilServicesUserTasks::ANON_FIRSTNAME = 'Anonymous' |
◆ ANON_GENDER
const ilServicesUserTasks::ANON_GENDER = 'm' |
◆ ANON_LASTNAME
const ilServicesUserTasks::ANON_LASTNAME = 'Exam-User' |
◆ ANON_LOGIN_PREFIX
const ilServicesUserTasks::ANON_LOGIN_PREFIX = 'EX-' |
◆ PASSWORD_CHARACTERSET
const ilServicesUserTasks::PASSWORD_CHARACTERSET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' |
The documentation for this class was generated from the following file: