33 $this->positionRepo =
$dic[
"repo.Positions"];
34 $this->assignmentRepo =
$dic[
"repo.UserAssignments"];
42 $this->stats = array(
'created' => 0,
'removed' => 0);
43 $a = file_get_contents($file_path,
'r');
46 if (!count($xml->children())) {
52 foreach ($xml->children() as
$a) {
62 $attributes = $a->attributes();
63 $action = $attributes->action;
64 $user_id_type = $a->User->attributes()->id_type;
66 $org_unit_id_type = $a->OrgUnit->attributes()->id_type;
67 $org_unit_id = (string) $a->OrgUnit;
68 $role = (
string) $a->Role;
71 $this->
addError(
'user_not_found', $a->User);
76 if (!$org_unit_id = $this->
buildRef($org_unit_id, $org_unit_id_type)) {
77 $this->
addError(
'org_unit_not_found', $a->OrgUnit);
83 if ($role ===
'employee') {
84 $position_id = $this->positionRepo
87 } elseif ($role ===
'superior') {
88 $position_id = $this->positionRepo
93 $position = $this->positionRepo->getSingle($role,
'title');
95 $position_id = $position->getId();
102 if ($action ==
'add') {
103 $assignment = $this->assignmentRepo->get(
$user_id, $position_id, $org_unit_id);
104 $this->stats[
'created']++;
105 } elseif ($action ==
'remove') {
106 $assignment = $this->assignmentRepo->find(
$user_id, $position_id, $org_unit_id);
108 $this->assignmentRepo->delete($assignment);
109 $this->stats[
'removed']++;
124 $ilDB = $DIC[
'ilDB'];
125 if ($type ==
'ilias_login') {
129 } elseif ($type ==
'external_id') {
133 } elseif ($type ==
'email') {
134 $q =
'SELECT usr_id FROM usr_data WHERE email = ' .
$ilDB->quote(
$id,
'text');
139 } elseif ($type ==
'user_id') {
static _lookupObjIdByImportId(string $import_id)
Get (latest) object id for an import id.
ilOrgUnitPositionDBRepository $positionRepo
const CORE_POSITION_EMPLOYEE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupId($a_user_str)
ilOrgUnitUserAssignmentDBRepository $assignmentRepo
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
buildRef($id, string $type)
simpleUserImportElement(SimpleXMLElement $a)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
const CORE_POSITION_SUPERIOR
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
simpleUserImport($file_path)
addError(string $lang_var, string $import_id, ?string $action=null)