42 $this->tabs_gui = $ilTabs;
44 $this->lng->loadLanguageModule(
'ldap');
48 $this->ctrl->saveParameter($this,
'ldap_server_id');
49 $this->ref_id = $a_auth_ref_id;
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
62 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id) &&
$cmd !=
"serverList")
65 $ilCtrl->redirect($this,
"serverList");
93 $this->tabs_gui->setSubTabActive(
'ldap_role_assignments');
95 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ldap_role_assignments.html',
'Services/LDAP');
97 include_once(
'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
99 $this->tpl->setVariable(
'NEW_ASSIGNMENT_TBL',$this->form->getHTML());
104 include_once(
"./Services/LDAP/classes/class.ilLDAPRoleAssignmentTableGUI.php");
106 $table_gui->setTitle($this->lng->txt(
"ldap_tbl_role_ass"));
107 $table_gui->parse($rules);
108 $table_gui->addMultiCommand(
"confirmDeleteRules", $this->lng->txt(
"delete"));
109 $table_gui->setSelectAllCheckbox(
"rule_id");
110 $this->tpl->setVariable(
'RULES_TBL',$table_gui->getHTML());
123 if(!(
int)
$_GET[
'rule_id'])
130 $this->tabs_gui->setSubTabActive(
'ldap_role_assignments');
132 $this->ctrl->saveParameter($this,
'rule_id',(
int) $_GET[
'rule_id']);
133 include_once(
'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
137 $this->tpl->setContent($this->form->getHTML());
149 $role_id = $this->role_mapping_rule->getRoleId();
150 if($rbacreview->isGlobalRole($role_id))
152 $val[
'role_name'] = 0;
153 $val[
'role_id'] = $role_id;
157 $val[
'role_name'] = 1;
160 $val[
'add_missing'] = (int) $this->role_mapping_rule->isAddOnUpdateEnabled();
161 $val[
'remove_deprecated'] = (int) $this->role_mapping_rule->isRemoveOnUpdateEnabled();
162 $val[
'type'] = (int) $this->role_mapping_rule->getType();
163 $val[
'dn'] = $this->role_mapping_rule->getDN();
164 $val[
'at'] = $this->role_mapping_rule->getMemberAttribute();
165 $val[
'isdn'] = $this->role_mapping_rule->isMemberAttributeDN();
166 $val[
'name'] = $this->role_mapping_rule->getAttributeName();
167 $val[
'value'] = $this->role_mapping_rule->getAttributeValue();
168 $val[
'plugin_id'] = $this->role_mapping_rule->getPluginId();
170 $this->form->setValuesByArray($val);
183 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
186 $this->roleAssignment();
190 include_once(
'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
191 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
201 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ldap_role_assignments.html',
'Services/LDAP');
204 $this->form->setValuesByPost();
205 $this->tpl->setVariable(
'NEW_ASSIGNMENT_TBL',$this->form->getHTML());
206 #$this->tpl->setVariable('RULES_TBL',$this->getRoleAssignmentTable());
207 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
215 $this->rule->update();
230 if(!is_array(
$_POST[
'rule_ids']))
237 $this->tabs_gui->setSubTabActive(
'ldap_role_assignments');
239 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
243 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteRules"));
244 $c_gui->setHeaderText($this->lng->txt(
"ldap_confirm_del_role_ass"));
245 $c_gui->setCancel($this->lng->txt(
"cancel"),
"roleAssignments");
246 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteRules");
249 include_once(
'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
250 foreach(
$_POST[
"rule_ids"] as $rule_id)
253 $c_gui->addItem(
'rule_ids[]',$rule_id,$rule->conditionToString());
255 $this->tpl->setContent($c_gui->getHTML());
266 if(!is_array(
$_POST[
'rule_ids']))
272 include_once(
'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
273 foreach(
$_POST[
"rule_ids"] as $rule_id)
293 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
296 $this->roleAssignment();
300 include_once(
'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
301 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
311 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ldap_role_assignments.html',
'Services/LDAP');
314 $this->form->setValuesByPost();
315 $this->tpl->setVariable(
'NEW_ASSIGNMENT_TBL',$this->form->getHTML());
317 $this->tabs_gui->setSubTabActive(
'shib_role_assignment');
325 $this->rule->create();
338 if($this->rule->getRoleId() > 0)
343 $_SESSION[
'ldap_role_ass'][
'rule_id'] = $_REQUEST[
'rule_id'] ? $_REQUEST[
'rule_id'] : 0;
344 $_SESSION[
'ldap_role_ass'][
'role_search'] = $this->form->getInput(
'role_search');
345 $_SESSION[
'ldap_role_ass'][
'add_on_update'] = $this->form->getInput(
'add_on_update');
346 $_SESSION[
'ldap_role_ass'][
'remove_on_update'] = $this->form->getInput(
'remove_deprecated');
347 $_SESSION[
'ldap_role_ass'][
'type'] = $this->form->getInput(
'type');
348 $_SESSION[
'ldap_role_ass'][
'dn'] = $this->form->getInput(
'dn');
349 $_SESSION[
'ldap_role_ass'][
'at'] = $this->form->getInput(
'at');
350 $_SESSION[
'ldap_role_ass'][
'isdn'] = $this->form->getInput(
'isdn');
351 $_SESSION[
'ldap_role_ass'][
'name'] = $this->form->getInput(
'name');
352 $_SESSION[
'ldap_role_ass'][
'value'] = $this->form->getInput(
'value');
353 $_SESSION[
'ldap_role_ass'][
'plugin'] = $this->form->getInput(
'plugin_id');
355 $this->ctrl->saveParameter($this,
'rule_id');
356 $this->ctrl->redirect($this,
'showRoleSelection');
368 $this->tabs_gui->setSubTabActive(
'ldap_role_assignment');
369 $this->ctrl->saveParameter($this,
'rule_id');
371 include_once
'./Services/Search/classes/class.ilQueryParser.php';
373 $parser->setMinWordLength(1,
true);
377 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
379 $object_search->setFilter(array(
'role'));
380 $res = $object_search->performSearch();
382 $entries =
$res->getEntries();
384 include_once
'./Services/AccessControl/classes/class.ilRoleSelectionTableGUI.php';
386 $table->setTitle($this->lng->txt(
'ldap_role_selection'));
387 $table->addMultiCommand(
'saveRoleSelection',$this->lng->txt(
'ldap_choose_role'));
388 $table->addCommandButton(
'roleAssignment',$this->lng->txt(
'cancel'));
389 $table->parse($entries);
391 $this->tpl->setContent($table->getHTML());
403 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
406 $this->roleAssignment();
410 if(!(
int) $_REQUEST[
'role_id'])
418 $this->rule->setRoleId((
int) $_REQUEST[
'role_id']);
420 if((
int) $_REQUEST[
'rule_id'])
422 $this->rule->update();
426 $this->rule->create();
445 $this->rule->validate();
446 return $ilErr->getMessage();
458 include_once(
"./Services/LDAP/classes/class.ilLDAPRoleAssignmentTableGUI.php");
460 $table_gui->setTitle($this->lng->txt(
"ldap_tbl_role_ass"));
461 $table_gui->parse($rules);
462 $table_gui->addMultiCommand(
"confirmDeleteRules", $this->lng->txt(
"delete"));
463 $table_gui->setSelectAllCheckbox(
"rule_id");
464 return $table_gui->getHTML();
477 if(is_object($this->rule))
482 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
488 if($this->form->getInput(
'role_name') == 0)
490 $this->rule->setRoleId($this->form->getInput(
'role_id'));
492 elseif($this->form->getInput(
'role_search'))
495 include_once
'./Services/Search/classes/class.ilQueryParser.php';
497 $parser =
new ilQueryParser($this->form->getInput(
'role_search'));
504 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
506 $object_search->setFilter(array(
'role'));
507 $res = $object_search->performSearch();
509 $entries =
$res->getEntries();
510 if(count($entries) == 1)
512 $role = current($entries);
513 $this->rule->setRoleId($role[
'obj_id']);
515 elseif(count($entries) > 1)
517 $this->rule->setRoleId(-1);
521 $this->rule->setAttributeName($this->form->getInput(
'name'));
522 $this->rule->setAttributeValue($this->form->getInput(
'value'));
523 $this->rule->setDN($this->form->getInput(
'dn'));
524 $this->rule->setMemberAttribute($this->form->getInput(
'at'));
525 $this->rule->setMemberIsDN($this->form->getInput(
'isdn'));
526 $this->rule->enableAddOnUpdate($this->form->getInput(
'add_missing'));
527 $this->rule->enableRemoveOnUpdate($this->form->getInput(
'remove_deprecated'));
528 $this->rule->setPluginId($this->form->getInput(
'plugin_id'));
529 $this->rule->setType($this->form->getInput(
'type'));
535 $this->rule->setServerId(0);
536 $this->rule->enableAddOnUpdate((
int)
$_SESSION[
'ldap_role_ass'][
'add_missing']);
537 $this->rule->enableRemoveOnUpdate((
int) $_SESSION[
'ldap_role_ass'][
'remove_deprecated']);
554 $this->tabs_gui->setSubTabActive(
'ldap_role_mapping');
556 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ldap_role_mapping.html',
'Services/LDAP');
557 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this,
'saveRoleMapping'));
560 $this->tpl->setVariable(
'TXT_ROLE_SETTINGS',$this->lng->txt(
'ldap_role_settings'));
561 $this->tpl->setVariable(
'TXT_ROLE_ACTIVE',$this->lng->txt(
'ldap_role_active'));
562 $this->tpl->setVariable(
'TXT_ROLE_BIND_USER',$this->lng->txt(
'ldap_role_bind_user'));
563 $this->tpl->setVariable(
'TXT_ROLE_BIND_PASS',$this->lng->txt(
'ldap_role_bind_pass'));
564 $this->tpl->setVariable(
'TXT_ROLE_ASSIGNMENTS',$this->lng->txt(
'ldap_role_assignments'));
565 $this->tpl->setVariable(
'TXT_BINDING',$this->lng->txt(
'ldap_server_binding'));
567 $this->tpl->setVariable(
'TXT_ROLE_BIND_USER_INFO',$this->lng->txt(
'ldap_role_bind_user_info'));
568 $this->tpl->setVariable(
'TXT_ROLE_ASSIGNMENTS_INFO',$this->lng->txt(
'ldap_role_assignments_info'));
571 $mapping_data = $this->role_mapping->getMappings();
576 $this->tpl->setVariable(
'TXT_NEW_ASSIGNMENT',$this->lng->txt(
'ldap_new_role_assignment'));
577 $this->tpl->setVariable(
'TXT_URL',$this->lng->txt(
'ldap_server'));
578 $this->tpl->setVariable(
'TXT_DN',$this->lng->txt(
'ldap_group_dn'));
579 $this->tpl->setVariable(
'TXT_MEMBER',$this->lng->txt(
'ldap_group_member'));
580 $this->tpl->setVariable(
'TXT_MEMBER_ISDN',$this->lng->txt(
'ldap_memberisdn'));
581 $this->tpl->setVariable(
'TXT_ROLE',$this->lng->txt(
'ldap_ilias_role'));
582 $this->tpl->setVariable(
'TXT_ROLE_INFO',$this->lng->txt(
'ldap_role_info'));
583 $this->tpl->setVariable(
'TXT_DN_INFO',$this->lng->txt(
'ldap_dn_info'));
584 $this->tpl->setVariable(
'TXT_MEMBER_INFO',$this->lng->txt(
'ldap_member_info'));
585 $this->tpl->setVariable(
'TXT_MEMBERISDN',$this->lng->txt(
'ldap_memberisdn'));
586 $this->tpl->setVariable(
'TXT_INFO',$this->lng->txt(
'ldap_info_text'));
587 $this->tpl->setVariable(
'TXT_INFO_INFO',$this->lng->txt(
'ldap_info_text_info'));
590 $this->tpl->setVariable(
'ROLE_BIND_USER',$this->server->getRoleBindDN());
591 $this->tpl->setVariable(
'ROLE_BIND_PASS',$this->server->getRoleBindPassword());
592 $this->tpl->setVariable(
'CHECK_ROLE_ACTIVE',
ilUtil::formCheckbox($this->server->enabledRoleSynchronization() ?
true :
false,
597 $this->tpl->setVariable(
'URL',$mapping_data[0][
'url'] ? $mapping_data[0][
'url'] : $this->server->getUrl());
598 $this->tpl->setVariable(
'DN',$mapping_data[0][
'dn']);
599 $this->tpl->setVariable(
'ROLE',$mapping_data[0][
'role_name']);
600 $this->tpl->setVariable(
'MEMBER',$mapping_data[0][
'member_attribute']);
602 'mapping[0][memberisdn]',
604 $this->tpl->setVariable(
'MAPPING_INFO',$mapping_data[0][
'info']);
606 $info_type_checked = isset($mapping_data[0][
'info_type']) ? $mapping_data[0][
'info_type'] : 1;
608 $this->tpl->setVariable(
'TXT_MAPPING_INFO_TYPE',$this->lng->txt(
'ldap_mapping_info_type'));
610 'mapping[0][info_type]',
613 unset($mapping_data[0]);
616 if(count($mapping_data))
618 $this->tpl->setCurrentBlock(
'txt_assignments');
619 $this->tpl->setVariable(
'TXT_ASSIGNMENTS',$this->lng->txt(
'ldap_role_group_assignments'));
620 $this->tpl->parseCurrentBlock();
622 $this->tpl->setCurrentBlock(
'delete_btn');
624 $this->tpl->setVariable(
'TXT_DELETE',$this->lng->txt(
'delete'));
625 $this->tpl->parseCurrentBlock();
630 foreach($mapping_data as
$data)
632 $mapping_id = $data[
'mapping_id'];
633 if(in_array($mapping_id,
$_SESSION[
'ldap_mapping_details']))
635 $this->tpl->setCurrentBlock(
'show_mapping_details');
636 $this->tpl->setVariable(
'ASS_GROUP_URL',$this->lng->txt(
'ldap_server_short'));
637 $this->tpl->setVariable(
'ASS_GROUP_DN',$this->lng->txt(
'ldap_group_dn_short'));
638 $this->tpl->setVariable(
'ASS_MEMBER_ATTR',$this->lng->txt(
'ldap_group_member_short'));
639 $this->tpl->setVariable(
'ASS_ROLE',$this->lng->txt(
'ldap_ilias_role_short'));
640 $this->tpl->setVariable(
'ASS_INFO',$this->lng->txt(
'ldap_info_text_short'));
641 $this->tpl->setVariable(
'ROW_ID',$mapping_id);
642 $this->tpl->setVariable(
'ROW_URL',$data[
'url']);
643 $this->tpl->setVariable(
'ROW_ROLE',$data[
'role_name'] ? $data[
'role_name'] : $data[
'role']);
644 $this->tpl->setVariable(
'ROW_DN',$data[
'dn']);
645 $this->tpl->setVariable(
'ROW_MEMBER',$data[
'member_attribute']);
646 $this->tpl->setVariable(
'TXT_ROW_MEMBERISDN',$this->lng->txt(
'ldap_memberisdn'));
648 'mapping['.$mapping_id.
'][memberisdn]',
651 $this->tpl->setVariable(
'TXT_ROW_INFO_TYPE',$this->lng->txt(
'ldap_mapping_info_type'));
653 'mapping['.$mapping_id.
'][info_type]',
655 $this->tpl->parseCurrentBlock();
659 $this->tpl->setCurrentBlock(
'assignments');
662 $this->ctrl->setParameter($this,
'mapping_id',$mapping_id);
663 $this->tpl->setVariable(
'COPY_LINK',$this->ctrl->getLinkTarget($this,
'roleMapping'));
664 $this->tpl->setVariable(
'TXT_COPY',$this->lng->txt(
'copy'));
665 $this->ctrl->clearParameters($this);
668 if(!in_array($mapping_id,
$_SESSION[
'ldap_mapping_details']))
670 $this->ctrl->setParameter($this,
'details_show',$mapping_id);
671 $this->tpl->setVariable(
'DETAILS_LINK',$this->ctrl->getLinkTarget($this,
'roleMapping'));
672 $this->tpl->setVariable(
'TXT_DETAILS',$this->lng->txt(
'show_details'));
673 $this->ctrl->clearParameters($this);
677 $this->ctrl->setParameter($this,
'details_hide',$mapping_id);
678 $this->tpl->setVariable(
'DETAILS_LINK',$this->ctrl->getLinkTarget($this,
'roleMapping'));
679 $this->tpl->setVariable(
'TXT_DETAILS',$this->lng->txt(
'hide_details'));
680 $this->ctrl->clearParameters($this);
682 if(!count(
$_SESSION[
'ldap_mapping_details']))
684 $this->tpl->setVariable(
'WIDTH',
"50%");
687 'mappings[]',$mapping_id));
688 $this->tpl->setVariable(
'TXT_TITLE_TITLE',$this->lng->txt(
'title'));
689 $this->tpl->setVariable(
'TXT_TITLE_ROLE',$this->lng->txt(
'obj_role'));
690 $this->tpl->setVariable(
'TXT_TITLE_GROUP',$this->lng->txt(
'obj_grp'));
691 $this->tpl->setVariable(
'TITLE_GROUP',$this->role_mapping->getMappingInfoString($mapping_id));
693 $this->tpl->setVariable(
'TITLE_ROLE',$data[
'role_name']);
695 $this->tpl->parseCurrentBlock();
699 $this->tpl->setVariable(
'TXT_SAVE',$this->lng->txt(
'save'));
700 $this->tpl->setVariable(
'TXT_REQUIRED_FLD',$this->lng->txt(
'required_field'));
706 if(!count(
$_POST[
'mappings']))
715 foreach(
$_POST[
'mappings'] as $mapping_id)
717 $this->role_mapping->delete($mapping_id);
726 unset(
$_POST[
'mapping_template']);
736 $this->server->enableRoleSynchronization((
int)
$_POST[
'role_sync_active']);
739 if($this->server->getServerId())
741 $this->server->update();
745 $_GET[
'ldap_server_id'] = $this->server->create();
749 $this->role_mapping->loadFromPost($_POST[
'mapping']);
750 if(!$this->role_mapping->validate())
756 $this->role_mapping->save();
768 $this->tabs_gui->setSubTabActive(
'ldap_user_mapping');
770 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ldap_user_mapping.html',
'Services/LDAP');
771 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
773 $this->tpl->setVariable(
'TXT_LDAP_MAPPING',$this->lng->txt(
'ldap_mapping_table'));
776 if(
$_POST[
'mapping_template'])
778 $this->tpl->setCurrentBlock(
'reset');
779 $this->tpl->setVariable(
'TXT_RESET',$this->lng->txt(
'reset'));
780 $this->tpl->parseCurrentBlock();
785 $this->tpl->setCurrentBlock(
'attribute_row');
786 $this->tpl->setVariable(
'TXT_NAME',$translation);
787 $this->tpl->setVariable(
'FIELD_NAME',$mapping.
'_value');
788 $this->tpl->setVariable(
'FIELD_VALUE',$this->mapping->getValue($mapping));
789 $this->tpl->setVariable(
'CHECK_FIELD',
ilUtil::formCheckbox($this->mapping->enabledUpdate($mapping),$mapping.
'_update',1));
790 $this->tpl->setVariable(
'UPDATE_INFO',$this->lng->txt(
'ldap_update_field_info'));
791 $this->tpl->parseCurrentBlock();
796 foreach($this->udf->getDefinitions() as $definition)
798 $this->tpl->setCurrentBlock(
'attribute_row');
799 $this->tpl->setVariable(
'TXT_NAME',$definition[
'field_name']);
800 $this->tpl->setVariable(
'FIELD_NAME',
'udf_'.$definition[
'field_id'].
'_value');
801 $this->tpl->setVariable(
'FIELD_VALUE',$this->mapping->getValue(
'udf_'.$definition[
'field_id']));
802 $this->tpl->setVariable(
'CHECK_FIELD',
ilUtil::formCheckbox($this->mapping->enabledUpdate(
'udf_'.$definition[
'field_id']),
803 'udf_'.$definition[
'field_id'].
'_update',1));
804 $this->tpl->setVariable(
'UPDATE_INFO',$this->lng->txt(
'ldap_update_field_info'));
805 $this->tpl->parseCurrentBlock();
809 $this->tpl->setVariable(
'TXT_SAVE',$this->lng->txt(
'save'));
810 $this->tpl->setVariable(
'TXT_SHOW',$this->lng->txt(
'show'));
815 if(!
$_POST[
'mapping_template'])
822 $this->mapping->clearRules();
824 include_once(
'Services/LDAP/classes/class.ilLDAPAttributeMappingUtils.php');
827 $this->mapping->setRule(
$key,$value,0);
841 foreach($this->udf->getDefinitions() as $definition)
843 $key =
'udf_'.$definition[
'field_id'];
847 $this->mapping->save();
851 unset(
$_POST[
'mapping_template']);
859 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id) &&
$cmd !=
"serverList")
861 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),$ilErr->WARNING);
865 $this->tabs_gui->setSubTabActive(
'ldap_settings');
869 return $this->tpl->setContent($this->form_gui->getHtml());
874 $this->form_gui->setValuesByArray(array(
875 'active' => $this->server->isActive(),
876 'server_name' => $this->server->getName(),
877 'server_url' => $this->server->getUrlString(),
878 'version' => $this->server->getVersion(),
879 'base_dn' => $this->server->getBaseDN(),
880 'referrals' => $this->server->isActiveReferrer(),
881 'tls' => $this->server->isActiveTLS(),
882 'binding_type' => $this->server->getBindingType(),
883 'bind_dn' => $this->server->getBindUser(),
884 'bind_pass' => $this->server->getBindPassword(),
885 'bind_pass_retype' => $this->server->getBindPassword(),
886 'search_base' => $this->server->getSearchBase(),
887 'user_scope' => $this->server->getUserScope(),
888 'user_attribute' => $this->server->getUserAttribute(),
889 'filter' => $this->server->getFilter(),
890 'group_dn' => $this->server->getGroupDN(),
891 'group_scope' => $this->server->getGroupScope(),
892 'group_filter' => $this->server->getGroupFilter(),
893 'group_member' => $this->server->getGroupMember(),
894 'memberisdn' => $this->server->enabledGroupMemberIsDN(),
895 'group' => $this->server->getGroupName(),
896 'group_attribute' => $this->server->getGroupAttribute(),
897 'group_optional' => $this->server->isMembershipOptional(),
898 'group_user_filter' => $this->server->getGroupUserFilter(),
899 'sync_on_login' => $this->server->enabledSyncOnLogin(),
900 'sync_per_cron' => $this->server->enabledSyncPerCron(),
902 'migration' => (
int)$this->server->isAccountMigrationEnabled(),
908 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
911 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'save'));
912 $this->form_gui->setTitle($this->lng->txt(
'ldap_configure'));
916 $this->form_gui->addItem($active);
918 $servername =
new ilTextInputGUI($this->lng->txt(
'ldap_server_name'),
'server_name');
920 $servername->setInfo($this->lng->txt(
'ldap_server_name_info'));
921 $servername->setSize(32);
922 $servername->setMaxLength(32);
923 $this->form_gui->addItem($servername);
925 $serverurl =
new ilTextInputGUI($this->lng->txt(
'ldap_server'),
'server_url');
927 $serverurl->setInfo($this->lng->txt(
'ldap_server_url_info'));
928 $serverurl->setSize(64);
929 $serverurl->setMaxLength(255);
930 $this->form_gui->addItem($serverurl);
932 $version =
new ilSelectInputGUI($this->lng->txt(
'ldap_version'),
'version');
934 $version->setInfo($this->lng->txt(
'ldap_server_version_info'));
935 $this->form_gui->addItem($version);
937 $basedsn =
new ilTextInputGUI($this->lng->txt(
'basedn'),
'base_dn');
939 $basedsn->setSize(64);
940 $basedsn->setMaxLength(255);
941 $this->form_gui->addItem($basedsn);
945 $referrals->setInfo($this->lng->txt(
'ldap_referrals_info'));
946 $this->form_gui->addItem($referrals);
949 $section_security->setTitle($this->lng->txt(
'ldap_server_security_settings'));
950 $this->form_gui->addItem($section_security);
954 $this->form_gui->addItem($tls);
958 $binding->addOption($anonymous);
960 $dn =
new ilTextInputGUI($this->lng->txt(
'ldap_server_bind_dn'),
'bind_dn');
962 $dn->setMaxLength(255);
963 $user->addSubItem($dn);
966 $pass->setMaxLength(36);
968 $binding->addOption(
$user);
969 $this->form_gui->addItem($binding);
972 $section_auth->setTitle($this->lng->txt(
'ldap_authentication_settings'));
973 $this->form_gui->addItem($section_auth);
975 $search_base =
new ilTextInputGUI($this->lng->txt(
'ldap_user_dn'),
'search_base');
976 $search_base->
setInfo($this->lng->txt(
'ldap_search_base_info'));
977 $search_base->setSize(64);
978 $search_base->setMaxLength(255);
979 $this->form_gui->addItem($search_base);
981 $user_scope =
new ilSelectInputGUI($this->lng->txt(
'ldap_user_scope'),
'user_scope');
984 $user_scope->setInfo($this->lng->txt(
'ldap_user_scope_info'));
985 $this->form_gui->addItem($user_scope);
987 $user_attribute =
new ilTextInputGUI($this->lng->txt(
'ldap_user_attribute'),
'user_attribute');
989 $user_attribute->setMaxLength(64);
990 $user_attribute->setRequired(
true);
991 $this->form_gui->addItem($user_attribute);
994 $filter->setInfo($this->lng->txt(
'ldap_filter_info'));
997 $this->form_gui->addItem(
$filter);
1000 $section_restrictions->setTitle($this->lng->txt(
'ldap_group_restrictions'));
1001 $this->form_gui->addItem($section_restrictions);
1003 $group_dn =
new ilTextInputGUI($this->lng->txt(
'ldap_group_search_base'),
'group_dn');
1004 $group_dn->
setInfo($this->lng->txt(
'ldap_group_dn_info'));
1005 $group_dn->setSize(64);
1006 $group_dn->setMaxLength(255);
1007 $this->form_gui->addItem($group_dn);
1009 $group_scope =
new ilSelectInputGUI($this->lng->txt(
'ldap_group_scope'),
'group_scope');
1012 $group_scope->setInfo($this->lng->txt(
'ldap_group_scope_info'));
1013 $this->form_gui->addItem($group_scope);
1015 $group_filter =
new ilTextInputGUI($this->lng->txt(
'ldap_group_filter'),
'group_filter');
1016 $group_filter->
setInfo($this->lng->txt(
'ldap_group_filter_info'));
1017 $group_filter->setSize(64);
1018 $group_filter->setMaxLength(255);
1019 $this->form_gui->addItem($group_filter);
1021 $group_member =
new ilTextInputGUI($this->lng->txt(
'ldap_group_member'),
'group_member');
1022 $group_member->
setInfo($this->lng->txt(
'ldap_group_member_info'));
1023 $group_member->setSize(32);
1024 $group_member->setMaxLength(255);
1025 $this->form_gui->addItem($group_member);
1028 $group_member_isdn =
new ilCheckboxInputGUI($this->lng->txt(
'ldap_memberisdn'),
'memberisdn');
1029 #$group_member_isdn->setInfo($this->lng->txt('ldap_group_member_info'));
1030 $this->form_gui->addItem($group_member_isdn);
1031 #$group_member->addSubItem($group_member_isdn);
1033 $group =
new ilTextInputGUI($this->lng->txt(
'ldap_group_name'),
'group');
1034 $group->
setInfo($this->lng->txt(
'ldap_group_name_info'));
1035 $group->setSize(32);
1036 $group->setMaxLength(255);
1037 $this->form_gui->addItem($group);
1039 $group_atrr =
new ilTextInputGUI($this->lng->txt(
'ldap_group_attribute'),
'group_attribute');
1040 $group_atrr->
setInfo($this->lng->txt(
'ldap_group_attribute_info'));
1041 $group_atrr->setSize(16);
1042 $group_atrr->setMaxLength(64);
1043 $this->form_gui->addItem($group_atrr);
1045 $group_optional =
new ilCheckboxInputGUI($this->lng->txt(
'ldap_group_membership'),
'group_optional');
1046 $group_optional->
setOptionTitle($this->lng->txt(
'ldap_group_member_optional'));
1047 $group_optional->setInfo($this->lng->txt(
'ldap_group_optional_info'));
1048 $group_optional->setValue(1);
1049 $group_user_filter =
new ilTextInputGUI($this->lng->txt(
'ldap_group_user_filter'),
'group_user_filter');
1050 $group_user_filter->
setSize(64);
1051 $group_user_filter->setMaxLength(255);
1052 $group_optional->addSubItem($group_user_filter);
1053 $this->form_gui->addItem($group_optional);
1056 $section_sync->setTitle($this->lng->txt(
'ldap_user_sync'));
1057 $this->form_gui->addItem($section_sync);
1060 $sync_on_login =
new ilCheckboxInputGUI($this->lng->txt(
'ldap_sync_login'),
'sync_on_login');
1061 $sync_on_login->setValue(1);
1063 $sync_per_cron =
new ilCheckboxInputGUI($this->lng->txt(
'ldap_sync_cron'),
'sync_per_cron');
1065 $ci_gui->addSubItem($sync_per_cron);
1066 $ci_gui->setInfo($this->lng->txt(
'ldap_user_sync_info'));
1067 $this->form_gui->addItem($ci_gui);
1069 $global_role =
new ilSelectInputGUI($this->lng->txt(
'ldap_global_role_assignment'),
'global_role');
1071 $global_role->setInfo($this->lng->txt(
'ldap_global_role_info'));
1072 $this->form_gui->addItem($global_role);
1075 $migr->
setInfo($this->lng->txt(
'auth_ldap_migration_info'));
1077 $this->form_gui->addItem($migr);
1079 $this->form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
1090 $this->tabs_gui->setSubTabActive(
'ldap_settings');
1093 if($this->form_gui->checkInput())
1095 $this->server->toggleActive((
int)$this->form_gui->getInput(
'active'));
1096 $this->server->setName($this->form_gui->getInput(
'server_name'));
1097 $this->server->setUrl($this->form_gui->getInput(
'server_url'));
1098 $this->server->setVersion($this->form_gui->getInput(
'version'));
1099 $this->server->setBaseDN($this->form_gui->getInput(
'base_dn'));
1100 $this->server->toggleReferrer($this->form_gui->getInput(
'referrals'));
1101 $this->server->toggleTLS($this->form_gui->getInput(
'tls'));
1102 $this->server->setBindingType((
int)$this->form_gui->getInput(
'binding_type'));
1103 $this->server->setBindUser($this->form_gui->getInput(
'bind_dn'));
1104 $this->server->setBindPassword($this->form_gui->getInput(
'bind_pass'));
1105 $this->server->setSearchBase($this->form_gui->getInput(
'search_base'));
1106 $this->server->setUserScope($this->form_gui->getInput(
'user_scope'));
1107 $this->server->setUserAttribute($this->form_gui->getInput(
'user_attribute'));
1108 $this->server->setFilter($this->form_gui->getInput(
'filter'));
1109 $this->server->setGroupDN($this->form_gui->getInput(
'group_dn'));
1110 $this->server->setGroupScope((
int)$this->form_gui->getInput(
'group_scope'));
1111 $this->server->setGroupFilter($this->form_gui->getInput(
'group_filter'));
1112 $this->server->setGroupMember($this->form_gui->getInput(
'group_member'));
1113 $this->server->enableGroupMemberIsDN((
int)$this->form_gui->getInput(
'memberisdn'));
1114 $this->server->setGroupName($this->form_gui->getInput(
'group'));
1115 $this->server->setGroupAttribute($this->form_gui->getInput(
'group_attribute'));
1116 $this->server->setGroupUserFilter($this->form_gui->getInput(
'group_user_filter'));
1117 $this->server->toggleMembershipOptional((
int)$this->form_gui->getInput(
'group_optional'));
1118 $this->server->enableSyncOnLogin((
int)$this->form_gui->getInput(
'sync_on_login'));
1119 $this->server->enableSyncPerCron((
int)$this->form_gui->getInput(
'sync_per_cron'));
1120 $this->server->setGlobalRole((
int)$this->form_gui->getInput(
'global_role'));
1121 $this->server->enableAccountMigration((
int)$this->form_gui->getInput(
'migration'));
1123 if(!$this->server->validate())
1126 $this->form_gui->setValuesByPost();
1127 return $this->tpl->setContent($this->form_gui->getHtml());
1131 if($this->server->getServerId())
1133 $this->server->update();
1137 $_GET[
'ldap_server_id'] = $this->server->create();
1142 $this->mapping->setRule(
'global_role', (
int)$this->form_gui->getInput(
'global_role'),
false);
1143 $this->mapping->save();
1146 $this->form_gui->setValuesByPost();
1147 return $this->tpl->setContent($this->form_gui->getHtml());
1150 $this->form_gui->setValuesByPost();
1151 return $this->tpl->setContent($this->form_gui->getHtml());
1163 $this->tabs_gui->addSubTabTarget(
"ldap_settings",
1164 $this->ctrl->getLinkTarget($this,
'serverList'),
1165 "serverList",get_class($this));
1168 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
1174 $this->tabs_gui->addSubTabTarget(
"ldap_user_mapping",
1175 $this->ctrl->getLinkTarget($this,
'userMapping'),
1176 "userMapping",get_class($this));
1178 $this->tabs_gui->addSubTabTarget(
'ldap_role_assignments',
1179 $this->ctrl->getLinkTarget($this,
'roleAssignments'),
1180 "roleAssignments",get_class($this));
1182 $this->tabs_gui->addSubTabTarget(
"ldap_role_mapping",
1183 $this->ctrl->getLinkTarget($this,
'roleMapping'),
1184 "roleMapping",get_class($this));
1191 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
1192 if(!
$_GET[
'ldap_server_id'])
1201 include_once
'./Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
1207 include_once
'./Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php';
1218 global $rbacreview,$ilObjDataCache;
1225 $select[0] = $this->lng->txt(
'links_select_one');
1226 foreach($global_roles as $role_id)
1242 global $rbacreview,$ilObjDataCache;
1244 include_once(
'./Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
1251 $select[0] = $this->lng->txt(
'links_select_one');
1252 foreach($global_roles as $role_id)
1260 'global_role',$select,
false,
true);
1271 return array(
'gender' => $this->lng->txt(
'gender'),
1272 'firstname' => $this->lng->txt(
'firstname'),
1273 'lastname' => $this->lng->txt(
'lastname'),
1274 'title' => $this->lng->txt(
'person_title'),
1275 'institution' => $this->lng->txt(
'institution'),
1276 'department' => $this->lng->txt(
'department'),
1277 'street' => $this->lng->txt(
'street'),
1278 'city' => $this->lng->txt(
'city'),
1279 'zipcode' => $this->lng->txt(
'zipcode'),
1280 'country' => $this->lng->txt(
'country'),
1281 'phone_office' => $this->lng->txt(
'phone_office'),
1282 'phone_home' => $this->lng->txt(
'phone_home'),
1283 'phone_mobile' => $this->lng->txt(
'phone_mobile'),
1284 'fax' => $this->lng->txt(
'fax'),
1285 'email' => $this->lng->txt(
'email'),
1286 'hobby' => $this->lng->txt(
'hobby'),
1287 'matriculation' => $this->lng->txt(
'matriculation'));
1288 #'photo' => $this->lng->txt('photo'));
1293 include_once(
"./Services/User/classes/class.ilUserDefinedFields.php");
1299 return ilUtil::formSelect(
$_POST[
'mapping_template'],
'mapping_template',array(0 => $this->lng->txt(
'ldap_mapping_template'),
1300 "inetOrgPerson" =>
'inetOrgPerson',
1301 "organizationalPerson" =>
'organizationalPerson',
1302 "person" =>
'person',
1303 "ad_2003" =>
'Active Directory (Win 2003)'),
false,
true);
1316 if(!isset(
$_GET[
'mapping_id']))
1318 return $a_mapping_data;
1320 $mapping_id =
$_GET[
'mapping_id'];
1321 $a_mapping_data[0] = $a_mapping_data[$mapping_id];
1323 return $a_mapping_data;
1334 if(!isset(
$_SESSION[
'ldap_mapping_details']))
1336 $_SESSION[
'ldap_mapping_details'] = array();
1338 if(isset(
$_GET[
'details_show']))
1340 $_SESSION[
'ldap_mapping_details'][
$_GET[
'details_show']] = $_GET[
'details_show'];
1342 if(isset(
$_GET[
'details_hide']))
1357 global $rbacreview,$ilObjDataCache;
1359 $new_mapping = array();
1360 $new_mapping = array();
1361 foreach($a_mapping_data as $mapping_id =>
$data)
1363 $new_mapping[$mapping_id] =
$data;
1364 $new_mapping[$mapping_id][
'obj_id'] = $obj_id = $rbacreview->getObjectOfRole(
$data[
'role']);
1365 $new_mapping[$mapping_id][
'obj_title'] = $ilObjDataCache->lookupTitle($obj_id);
1366 $new_mapping[$mapping_id][
'mapping_id'] = $mapping_id;
1382 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
1383 include_once(
'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
1386 $this->form->setFormAction($this->ctrl->getFormAction($this));
1391 $this->form->setTitle($this->lng->txt(
'ldap_edit_role_ass_rule'));
1392 $this->form->addCommandButton(
'updateRoleAssignment',$this->lng->txt(
'save'));
1393 $this->form->addCommandButton(
'roleAssignments',$this->lng->txt(
'cancel'));
1396 $this->form->setTitle($this->lng->txt(
'ldap_add_role_ass_rule'));
1397 $this->form->addCommandButton(
'addRoleAssignment',$this->lng->txt(
'ldap_btn_add_role_ass'));
1398 $this->form->addCommandButton(
'roleAssignments',$this->lng->txt(
'cancel'));
1406 $global =
new ilRadioOption($this->lng->txt(
'ldap_global_role'),0);
1407 $role->addOption($global);
1411 $global->addSubItem($role_select);
1413 $local =
new ilRadioOption($this->lng->txt(
'ldap_local_role'),1);
1414 $role->addOption($local);
1416 include_once
'./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php';
1418 $role_search->setSize(40);
1419 $local->addSubItem($role_search);
1421 $role->setInfo($this->lng->txt(
'ldap_role_name_info'));
1422 $this->form->addItem($role);
1426 $update->
setValue($this->lng->txt(
'ldap_check_role_assignment'));
1429 $add->setOptionTitle($this->lng->txt(
'ldap_add_missing'));
1430 $update->addSubItem($add);
1433 $remove->setOptionTitle($this->lng->txt(
'ldap_remove_deprecated'));
1434 $update->addSubItem($remove);
1436 $this->form->addItem($update);
1442 #$group->setValue($current_rule->getType());
1449 #$dn->setValue($current_rule->getDN());
1451 $dn->setMaxLength(512);
1452 $dn->
setInfo($this->lng->txt(
'ldap_role_grp_dn_info'));
1453 $radio_group->addSubItem($dn);
1454 $at =
new ilTextInputGUI($this->lng->txt(
'ldap_role_grp_at'),
'at');
1455 #$at->setValue($current_rule->getMemberAttribute());
1457 $at->setMaxLength(128);
1458 $radio_group->addSubItem($at);
1460 #$isdn->setChecked($current_rule->isMemberAttributeDN());
1461 $isdn->
setInfo($this->lng->txt(
'ldap_group_member_info'));
1462 $radio_group->addSubItem($isdn);
1463 $radio_group->setInfo($this->lng->txt(
'ldap_role_grp_info'));
1465 $group->addOption($radio_group);
1470 #$name->setValue($current_rule->getAttributeName());
1472 $name->setMaxLength(128);
1473 #$name->setInfo($this->lng->txt('ldap_role_at_name_info'));
1477 $val =
new ilTextInputGUI($this->lng->txt(
'ldap_role_at_value'),
'value');
1478 #$val->setValue($current_rule->getAttributeValue());
1480 $val->setMaxLength(128);
1481 #$val->setInfo($this->lng->txt('ldap_role_at_value_info'));
1482 $radio_attribute->addSubItem($val);
1483 $radio_attribute->setInfo($this->lng->txt(
'ldap_role_at_info'));
1485 $group->addOption($radio_attribute);
1490 $pl->
setInfo($this->lng->txt(
'ldap_plugin_info'));
1491 $pl->setDisabled(!$pl_active);
1496 $id->setMaxLength(3);
1497 $id->setMaxValue(999);
1498 $id->setMinValue(1);
1499 $pl->addSubItem($id);
1501 $group->addOption($pl);
1502 $this->form->addItem($group);
1511 global $ilPluginAdmin;
1513 return count($ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
'LDAP',
'ldaphk')) ?
true :
false;
1522 include_once(
"./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php");