18 declare(strict_types=1);
    31     private ?ilECSnodeMappingSettings 
$mapping = null;
    39         $this->log = $DIC->logger()->wsrv();
    66             $details = $crsm_reader->getCourseMember($a_content_id, 
true);
    67             $this->mid = 
$details->getMySender();
    71             if (!$part->isImportEnabled()) {
    72                 $this->log->warning(
'Import disabled for mid ' . $this->
getMid());
    80             return $this->mapping->isCourseAllocationEnabled();
    82             $this->log->error(
'Reading course member details failed with message ' . $e->getMessage());
    99             $this->
doUpdate($a_content_id, $course_member);
   102             $this->log->error(
'Course member creation failed  with mesage ' . $e->getMessage());
   128             $this->
doUpdate($a_content_id, $course_member);
   131             $this->log->error(
'Course member update failed  with mesage ' . $e->getMessage());
   141     protected function doUpdate($a_content_id, $course_member): bool
   143         $this->log->debug(
'Starting ecs member update');
   145         if (is_array($course_member) && !isset($course_member[
"lectureID"])) {
   146             $this->log->warning(
'Missing course id in course_member');
   150         $course_id = (
int) $course_member->lectureID;
   152             $this->log->warning(
'Missing course id');
   155         $this->log->debug(
'sid: ' . $this->
getServer()->getServerId() . 
' course_id: ' . $course_id . 
' mid: ' . $this->mid);
   160             $this->log->info(
'No main course created. Group scenario >= 3 ?');
   164         if (is_null($course)) {
   165             $this->log->info(
'No course found, skip processing' . print_r($course_member, 
true));
   171         $this->log->debug(
'Parallel group assignments');
   173         $this->log->debug(
'------------------ End assignemtns');
   176         foreach ($assignments as $cms_id => $assigned) {
   177             $sub_id = ($cms_id === $course_id) ? null : (
string) $cms_id;
   179             $this->log->debug(
'sub id is ' . is_null($sub_id) ? 
"<null>" : $sub_id . 
' for ' . $cms_id);
   199         if (!property_exists($course, 
'groupScenario')) {
   203         switch ((
int) $course->groupScenario) {
   205                 $this->log->debug(
'Parallel group scenario one course.');
   209                 $this->log->debug(
'Parallel group scenario groups in courses.');
   213                 $this->log->debug(
'Parallel group scenario only courses.');
   217                 $this->log->debug(
'Parallel group scenario undefined.');
   221         $course_id = $course_member->lectureID;
   223         foreach ((array) $course_member->members as $member) {
   224             $assigned[$course_id][$member->personID] = array(
   225                 'id' => $member->personID,
   226                 'role' => $member->role
   229                 $this->log->debug(
'Group scenarion "one course". Ignoring group assignments');
   233             if (property_exists($member, 
'groups')) {
   234                 foreach ((array) $member->groups as $pgroup) {
   236                     $sequence_number = (
int) $pgroup->num;
   238                     if (property_exists($course, 
'groups')) {
   239                         $tmp_pgroup = $course->groups[$sequence_number] ?? null;
   241                         if (is_object($tmp_pgroup) && $tmp_pgroup->id !== 
'') {
   242                             $this->log->debug(
'Found parallel group with id: ' . $tmp_pgroup->id . 
': for sequence number: ' . $sequence_number);
   245                             $assigned[$tmp_pgroup->id][$member->personID] = array(
   246                                 'id' => $member->personID,
   247                                 'role' => $pgroup->role
   250                             $this->log->warning(
'Cannot find parallel group with sequence id: ' . $sequence_number);
   253                         $this->log->error(
'Invalid course/group-configuration found, ignoring}');
   259         $this->log->debug(
'ECS member assignments ' . print_r($assigned, 
true));
   270         $this->log->debug(
'Currrent sub_id = ' . $sub_id . 
', obj_id = ' . $obj_id);
   273         if ($type === 
'crs') {
   275         } elseif ($type === 
'grp') {
   278             $this->log->warning(
'Invalid object type given for obj_id: ' . $obj_id);
   282         $course_id = (
int) $course_member->lectureID;
   285             is_null($sub_id) ? $sub_id : (
int) $sub_id,
   288         $this->log->debug(
'Current coursemember assignments:');
   292         foreach ($usr_ids as $usr_id) {
   293             if (!isset($assigned[$usr_id])) {
   297                         $this->mapping->getAuthMode(),
   301                     $this->log->debug(
'Local user assignment: ' . $usr_id . 
' <-> ' . $login);
   305                         $part->delete($il_usr_id);
   308                         $this->log->notice(
'Deassigning unknown ILIAS user ' . $usr_id . 
' ' . 
'from course ' . 
ilObject::_lookupTitle($obj_id));
   316         $this->log->debug(
'Handled assignmnent...');
   319         foreach ((array) $assigned as $person_id => $person) {
   320             $role = $this->
lookupRole((
string) $person[
'role'], $type);
   323             $this->log->debug(
'Using role info...');
   325                 $this->mapping->getAuthMode(),
   328             $this->log->info(
'Handling user ' . $person_id);
   330             if (in_array($person_id, $usr_ids, 
true)) {
   332                     $this->log->info(
'Update user assignment for: ' . $person_id);
   333                     $part->updateRoleAssignments($il_usr_id, array($part->getAutoGeneratedRoleId($role)));
   334                 } elseif ($role_info[
'create']) {
   336                     $this->log->info(
'Added new user ' . $person_id);
   338                         $this->mapping->getAuthMode(),
   342                         $part->add($il_usr_id, $role);
   351                         $this->log->info(
'Assigning new user ' . $person_id . 
' ' . 
'to ' . 
ilObject::_lookupTitle($obj_id) . 
' using role: ' . $role);
   352                         $part->add($il_usr_id, $role);
   357                     if ($role_info[
'create']) {
   359                         $this->log->info(
'Added new user ' . $person_id);
   361                             $this->mapping->getAuthMode(),
   367                         $this->log->info(
'Assigning new role to existing user ' . $person_id . 
' ' . 
'to ' . 
ilObject::_lookupTitle($obj_id) . 
' using role: ' . $role);
   368                         $part->add($il_usr_id, $role);
   374                 $assignment->setServer($this->
getServer()->getServerId());
   375                 $assignment->setMid($this->mid);
   376                 $assignment->setCmsId($course_id);
   377                 $assignment->setCmsSubId(is_null($sub_id) ? $sub_id : (
int) $sub_id);
   378                 $assignment->setObjId($obj_id);
   379                 $assignment->setUid((
string) $person_id);
   391         $role_mappings = $this->mapping->getRoleMappings();
   395             $this->log->debug(
'No role assignment attribute: role');
   397         foreach ($role_mappings as $name => $map) {
   398             $this->log->debug(
'Role "name" is ' . $name);
   401             $exploded_map = (array) explode(
',', $map);
   402             if (in_array($role_value, $exploded_map, 
true)) {
   407                         if ($a_obj_type === 
'crs') {
   408                             $this->log->debug(
'Role: ' . $role_value . 
' maps: ' . $map);
   415                         if ($a_obj_type === 
'grp') {
   416                             $this->log->debug(
'Role: ' . $role_value . 
' maps: ' . $map);
   423         $this->log->info(
'No role assignment mapping for role ' . $role_value);
   433             $this->log->warning(
'Node mapping settings not initialized.');
   435         $auth_mode = $this->mapping->getAuthMode();
   438             $this->mapping->getAuthMode() ===
   441             $this->log->info(
'Not handling direct user creation for auth mode: ' . $auth_mode);
   444         if (strpos($auth_mode, 
'ldap') !== 0) {
   445             $this->log->info(
'Not handling direct user creation for auth mode: ' . $auth_mode);
   451             $server->doConnectionCheck();
   456             $users = $query->fetchUser((
string) $a_person_id);
   461                 $xml->setNewUserAuthMode($server->getAuthenticationMappingKey());
   462                 $xml->setUserData($users);
   466             $this->log->error($exc->getMessage());
   487             $course_member->lectureID
 
handleCreate(ilECSSetting $server, $a_content_id)
Handle create. 
 
static _getFirstActiveServer()
Get first active server. 
 
static getInstance(int $a_server_id, int $mid)
Get instance by server id and mid. 
 
static getRoleMappingInfo($a_role_type_info=0)
Get role mapping info. 
 
__construct(ilECSSetting $server)
Constructor. 
 
const TYPE_ADMISSION_MEMBER
 
static getInstanceByServerId(int $a_server_id)
Get instance by server id. 
 
static getInstanceByServerMid(int $a_server_id, int $a_mid)
Get instance. 
 
ilECSnodeMappingSettings $mapping
 
static _lookupId($a_user_str)
 
lookupRole(string $role_value, $a_obj_type)
Lookup local role by assignment. 
 
static _checkExternalAuthAccount(string $a_auth, string $a_account, bool $tryFallback=true)
check whether external account and authentication method matches with a user 
 
const PARALLEL_ONE_COURSE
 
checkAllocationActivation(ilECSSetting $server, $a_content_id)
Check if course allocation is activated for one recipient of the. 
 
static _getAuthModeName($a_auth_key)
 
Interface for all command queue handler classes. 
 
handleDelete(ilECSSetting $server, $a_content_id)
Handle delete. 
 
createMember($a_person_id)
Create user account. 
 
static lookupAssignment(int $a_cms_id, ?int $a_cms_sub_id, int $a_obj_id, string $a_usr_id)
Lookup assignment of user. 
 
Synchronize member assignments. 
 
static getInstance()
Get the singleton instance of this ilECSImportManager. 
 
if(!file_exists(getcwd() . '/ilias.ini.php'))
 
doUpdate($a_content_id, $course_member)
Perform update. 
 
static _lookupTitle(int $obj_id)
 
static _getInstanceByObjId(int $a_obj_id)
 
readAssignments($course, $course_member)
Read assignments for all parallel groups. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static lookupUserIds(int $a_cms_id, ?int $a_cms_sub_id, int $a_obj_id)
Lookup user ids. 
 
Connector for course member ressource. 
 
const PARALLEL_ALL_COURSES
 
Storage of ecs course assignments. 
 
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance. 
 
readCourseMember(ilECSSetting $server, $a_content_id)
Read course from ecs. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
handleUpdate(ilECSSetting $server, $a_content_id)
Handle update. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
const PARALLEL_GROUPS_IN_COURSE
 
refreshAssignmentStatus(object $course_member, int $obj_id, ?string $sub_id, $assigned)
Refresh status of course member assignments. 
 
static _lookupType(int $id, bool $reference=false)
 
readCourse($course_member)
Read course from ecs.