20 $this->stats =
array(
'created' => 0,
'removed' => 0 );
21 $a = file_get_contents($file_path,
'r');
24 if (!count(
$xml->Assignment)) {
25 $this->
addError(
'no_assignment', null, null);
30 foreach (
$xml->Assignment as $a) {
42 $rbacadmin = $DIC[
'rbacadmin'];
46 $user_id_type = $a->User->attributes()->id_type;
47 $user_id = (
string) $a->User;
48 $org_unit_id_type = $a->OrgUnit->attributes()->id_type;
49 $org_unit_id = (
string) $a->OrgUnit;
50 $role = (
string) $a->Role;
52 if (!$user_id = $this->
buildUserId($user_id, $user_id_type)) {
53 $this->
addError(
'user_not_found', $a->User);
58 if (!$org_unit_id = $this->
buildRef($org_unit_id, $org_unit_id_type)) {
59 $this->
addError(
'org_unit_not_found', $a->OrgUnit);
65 if ($role ==
'employee') {
66 $role_id = $org_unit->getEmployeeRole();
67 } elseif ($role ==
'superior') {
68 $role_id = $org_unit->getSuperiorRole();
70 $this->
addError(
'not_a_valid_role', $user_id);
76 $rbacadmin->assignUser($role_id, $user_id);
77 $this->stats[
'created']++;
78 } elseif (
$action ==
'remove') {
79 $rbacadmin->deassignUser($role_id, $user_id);
80 $this->stats[
'removed']++;
82 $this->
addError(
'not_a_valid_action', $user_id);
97 if (
$type ==
'ilias_login') {
100 return $user_id ? $user_id :
false;
101 } elseif (
$type ==
'external_id') {
104 return $user_id ? $user_id :
false;
105 } elseif (
$type ==
'email') {
106 $q =
'SELECT usr_id FROM usr_data WHERE email = ' .
$ilDB->quote(
$id,
'text');
107 $set =
$ilDB->query($q);
108 $user_id =
$ilDB->fetchAssoc($set);
110 return $user_id ? $user_id :
false;
111 } elseif (
$type ==
'user_id') {
Class ilOrgUnitSimpleUserImport.
if(!array_key_exists('StateId', $_REQUEST)) $id
static _lookupId($a_user_str)
Lookup id by login.
addError($lang_var, $import_id, $action=null)
simpleUserImportElement(SimpleXMLElement $a)
Create styles array
The data for the language used.
simpleUserImport($file_path)
static _lookupObjIdByImportId($a_import_id)