20        $this->stats = array(
'created' => 0, 
'removed' => 0);
 
   21        $a = file_get_contents($file_path, 
'r');
 
   22        $xml = 
new SimpleXMLElement(
$a);
 
   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 = 
$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') {
 
   73                $position_id = $position->getId();
 
   75                $this->
addError(
'not_a_valid_role', $user_id);
 
   80        if ($action == 
'add') {
 
   84            $this->stats[
'created']++;
 
   85        } elseif ($action == 
'remove') {
 
   87            $assignment->delete();
 
   88            $this->stats[
'removed']++;
 
   90            $this->
addError(
'not_a_valid_action', $user_id);
 
  105        if (
$type == 
'ilias_login') {
 
  108            return $user_id ? $user_id : 
false;
 
  109        } elseif (
$type == 
'external_id') {
 
  112            return $user_id ? $user_id : 
false;
 
  113        } elseif (
$type == 
'email') {
 
  114            $q = 
'SELECT usr_id FROM usr_data WHERE email = ' . 
$ilDB->quote($id, 
'text');
 
  115            $set = 
$ilDB->query($q);
 
  116            $user_id = 
$ilDB->fetchAssoc($set);
 
  118            return $user_id ? $user_id : 
false;
 
  119        } elseif (
$type == 
'user_id') {
 
static where($where, $operator=null)
An exception for terminatinating execution or to throw for unit testing.
static _lookupId($a_user_str)
Lookup id by login.
static _lookupObjIdByImportId($a_import_id)
addError($lang_var, $import_id, $action=null)
const CORE_POSITION_EMPLOYEE
const CORE_POSITION_SUPERIOR
Class ilOrgUnitSimpleUserImport.
simpleUserImportElement(SimpleXMLElement $a)
simpleUserImport($file_path)
static findOrCreateAssignment($user_id, $position_id, $orgu_id)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples