20 $this->stats = array(
'created' => 0,
'removed' => 0 );
21 $a = file_get_contents($file_path,
'r');
24 if (!count(
$xml->children())) {
25 $this->
addError(
'no_assignment', null, null);
30 foreach (
$xml->children() as $a) {
42 $rbacadmin = $DIC[
'rbacadmin'];
46 $user_id_type = (
string) $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') {
67 } elseif ($role ===
'superior') {
70 $this->
addError(
'not_a_valid_role', $user_id);
79 $this->stats[
'created']++;
80 } elseif (
$action ==
'remove') {
82 $assignment->delete();
83 $this->stats[
'removed']++;
85 $this->
addError(
'not_a_valid_action', $user_id);
100 if (
$type ==
'ilias_login') {
103 return $user_id ? $user_id :
false;
104 } elseif (
$type ==
'external_id') {
107 return $user_id ? $user_id :
false;
108 } elseif (
$type ==
'email') {
109 $q =
'SELECT usr_id FROM usr_data WHERE email = ' .
$ilDB->quote(
$id,
'text');
110 $set =
$ilDB->query($q);
111 $user_id =
$ilDB->fetchAssoc($set);
113 return $user_id ? $user_id :
false;
114 } elseif (
$type ==
'user_id') {
static findOrCreateAssignment($user_id, $position_id, $orgu_id)
const CORE_POSITION_EMPLOYEE
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)
if(array_key_exists('yes', $_REQUEST)) $attributes
const CORE_POSITION_SUPERIOR
simpleUserImport($file_path)
static _lookupObjIdByImportId($a_import_id)