5 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
6 include_once
'./Services/WebServices/ECS/interfaces/interface.ilECSCommandQueueHandler.php';
7 include_once
'./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
8 include_once
'./Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
32 $this->log =
$GLOBALS[
'DIC']->logger()->wsrv();
73 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCourseMemberConnector.php';
75 $details = $crsm_reader->getCourseMember($a_content_id,
true);
76 $this->mid = $details->getMySender();
79 include_once
'./Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
81 if(!$part->isImportEnabled())
83 $this->log->warning(
'Import disabled for mid '.$this->
getMid());
87 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
96 $this->log->error(
'Reading course member details failed with message '. $e->getMessage());
109 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
110 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
111 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCourseConnector.php';
121 $this->
doUpdate($a_content_id,$course_member);
126 $this->log->error(
'Course member creation failed with mesage ' . $e->getMessage());
158 $this->
doUpdate($a_content_id, $course_member);
163 $this->log->error(
'Course member update failed with mesage ' . $e->getMessage());
174 protected function doUpdate($a_content_id, $course_member)
176 $this->log->debug(
'Starting ecs member update');
178 $course_id = (int) $course_member->lectureID;
181 $this->log->warning(
'Missing course id');
184 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
185 $this->log->debug(
'sid: '.$this->
getServer()->getServerId().
' course_id: '.$course_id.
' mid: '.$this->mid);
191 $this->log->info(
'No main course created. Group scenario >= 3 ?');
198 $this->log->debug(
'Parallel group assignments');
200 $this->log->debug(
'------------------ End assignemtns');
203 foreach((
array) $assignments as $cms_id => $assigned)
205 $sub_id = ($cms_id == $course_id) ? null : $cms_id;
207 $this->log->debug(
'sub id is ' . $sub_id .
' for ' . $cms_id);
209 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
228 $put_in_course =
true;
230 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
231 switch((
int) $course->groupScenario)
234 $this->log->debug(
'Parallel group scenario one course.');
235 $put_in_course =
true;
239 $this->log->debug(
'Parallel group scenario groups in courses.');
240 $put_in_course =
false;
244 $this->log->debug(
'Parallel group scenario only courses.');
245 $put_in_course =
false;
249 $this->log->debug(
'Parallel group scenario undefined.');
250 $put_in_course =
true;
254 $course_id = $course_member->lectureID;
256 foreach((
array) $course_member->members as $member)
258 $assigned[$course_id][$member->personID] =
array(
259 'id' => $member->personID,
260 'role' => $member->role
264 $this->log->debug(
'Group scenarion "one course". Ignoring group assignments');
268 foreach((
array) $member->groups as $pgroup)
271 $sequence_number = (int) $pgroup->num;
273 $tmp_pgroup = $course->groups[$sequence_number];
274 if(is_object($tmp_pgroup))
276 $pgroup_id = $tmp_pgroup->id;
278 if(strlen($pgroup_id))
280 $this->log->debug(
'Found parallel group with id: '. $pgroup_id.
': for sequence number: '.$sequence_number);
283 $assigned[$pgroup_id][$member->personID] =
array(
284 'id' => $member->personID,
285 'role' => $pgroup->role
290 $this->log->warning(
'Cannot find parallel group with sequence id: ' . $sequence_number);
294 $this->log->debug(
'ECS member assignments '.print_r($assigned,
true));
307 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCourseMemberAssignment.php';
309 $this->log->debug(
'Currrent sub_id = ' . $sub_id.
', obj_id = ' . $obj_id);
314 include_once
'./Modules/Course/classes/class.ilCourseParticipants.php';
317 elseif($type ==
'grp')
319 include_once
'./Modules/Group/classes/class.ilGroupParticipants.php';
324 $this->log->warning(
'Invalid object type given for obj_id: ' . $obj_id);
328 $course_id = (int) $course_member->lectureID;
335 foreach((
array) $usr_ids as $usr_id)
337 if(!isset($assigned[$usr_id]))
347 $this->log->debug(
'Local user assignment: ' . (
string) $usr_id .
' <-> ' . $login);
352 $part->delete($il_usr_id);
357 $this->log->notice(
'Deassigning unknown ILIAS user ' . $usr_id.
' '.
'from course '.
ilObject::_lookupTitle($obj_id));
365 $this->log->debug(
'Handled assignmnent...');
368 foreach((
array) $assigned as $person_id => $person)
370 $role = $this->
lookupRole($person[
'role'],$type);
373 $this->log->debug(
'Using role info...');
378 $this->log->info(
'Handling user '. (
string) $person_id);
380 if(in_array($person_id, $usr_ids))
384 $part->updateRoleAssignments($il_usr_id,
array($part->getAutoGeneratedRoleId($role)));
386 elseif($role_info[
'create'])
389 $this->log->info(
'Added new user '. $person_id);
398 $part->add($il_usr_id,$role);
399 $part->sendNotification($part->NOTIFY_ACCEPT_USER, $il_usr_id);
412 $this->log->info(
'Assigning new user ' . $person_id.
' '.
'to '.
ilObject::_lookupTitle($obj_id).
' using role: ' . $role);
413 $part->add($il_usr_id,$role);
414 $part->sendNotification($part->NOTIFY_ACCEPT_USER, $il_usr_id);
420 if($role_info[
'create'])
423 $this->log->info(
'Added new user '. $person_id);
434 $part->add($il_usr_id,$role);
435 $part->sendNotification($part->NOTIFY_ACCEPT_USER, $il_usr_id);
441 $assignment->setServer($this->
getServer()->getServerId());
442 $assignment->setMid($this->mid);
443 $assignment->setCmsId($course_id);
444 $assignment->setCmsSubId($sub_id);
445 $assignment->setObjId($obj_id);
446 $assignment->setUid($person_id);
465 $this->log->debug(
'No role assignment attribute: role');
467 foreach($role_mappings as $name => $map)
469 $this->log->debug(
'Role "name" is ' . $name);
472 $exploded_map = (
array) explode(
',', $map);
473 if(in_array($role_value, $exploded_map))
480 if($a_obj_type ==
'crs')
482 $this->log->debug(
'Role: ' . $role_value.
' maps: ' . $exploded_map);
489 if($a_obj_type ==
'grp')
491 $this->log->debug(
'Role: ' . $role_value.
' maps: ' . $exploded_map);
498 $this->log->info(
'No role assignment mapping for role ' . $role_value);
509 $this->log->warning(
'Node mapping settings not initialized.');
518 $this->log->info(
'Not handling direct user creation for auth mode: ' . $auth_mode);
521 if(substr($auth_mode,0,4) !==
'ldap')
523 $this->log->info(
'Not handling direct user creation for auth mode: ' . $auth_mode);
529 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
533 include_once
'./Services/LDAP/classes/class.ilLDAPQuery.php';
537 $users =
$query->fetchUser($a_person_id,
true);
540 include_once
'./Services/User/classes/class.ilUserCreationContext.php';
543 include_once
'./Services/LDAP/classes/class.ilLDAPAttributeToUser.php';
545 $xml->setNewUserAuthMode(
$server->getAuthenticationMappingKey());
546 $xml->setUserData($users);
553 $this->log->error($exc->getMessage());
566 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCourseMemberConnector.php';
569 $member = $crs_member_reader->getCourseMember($a_content_id);
586 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
590 $course_member->lectureID
593 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCourseConnector.php';
595 return $crs_reader->getCourse($ecs_id);
handleCreate(ilECSSetting $server, $a_content_id)
Handle create.
getMappingSettings()
Get mapping settings.
static _getFirstActiveServer()
Get first active server.
static getRoleMappingInfo($a_role_type_info=0)
Get role mapping info.
__construct(ilECSSetting $server)
Constructor.
lookupRole($role_value, $a_obj_type)
Lookup local role by assignment.
static getInstance()
Get instance.
const IL_LDAP_BIND_DEFAULT
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static getInstanceByServerMid($a_server_id, $a_mid)
Get instance.
static _lookupId($a_user_str)
Lookup id by login.
refreshAssignmentStatus($course_member, $obj_id, $sub_id, $assigned)
Refresh status of course member assignments.
static _lookupTitle($a_id)
lookup object title
const PARALLEL_ONE_COURSE
checkAllocationActivation(ilECSSetting $server, $a_content_id)
Check if course allocation is activated for one recipient of the.
static lookupObjIdByContentId($a_server_id, $a_mid, $a_content_id, $a_sub_id=null)
Lookup obj_id by content id.
static _getAuthModeName($a_auth_key)
Interface for all command queue handler classes.
static getInstanceByServerId($a_server_id)
Get instance by server id.
handleDelete(ilECSSetting $server, $a_content_id)
Handle delete.
createMember($a_person_id)
Create user account.
Synchronize member assignments.
doUpdate($a_content_id, $course_member)
Perform update.
static lookupUserIds($a_cms_id, $a_cms_sub_id, $a_obj_id)
Lookup user ids type $ilDB.
readAssignments($course, $course_member)
Read assignments for all parallel groups.
static getInstance($a_server_id, $mid)
Get instance by server id and mid.
static lookupAssignment($a_cms_id, $a_cms_sub_id, $a_obj_id, $a_usr_id)
Lookup assignment of user type $ilDB.
const IL_CRS_ADMIN
Base class for course and group participants.
static lookupEContentIdByContentId($a_server_id, $a_mid, $a_content_id)
Lookup econtent id The econtent id is the unique id from ecs.
Connector for course member ressource.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
const PARALLEL_ALL_COURSES
Storage of ecs course assignments.
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
readCourseMember(ilECSSetting $server, $a_content_id)
Read course from ecs.
handleUpdate(ilECSSetting $server, $a_content_id)
Handle update.
Update/create ILIAS user account by given LDAP attributes according to user attribute mapping setting...
const PARALLEL_GROUPS_IN_COURSE
readCourse($course_member)
Read course from ecs.