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)
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();
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);
866 ilUtil::sendFailure(
'Missing LDAP libraries. Please ensure that the PHP LDAP module is installed on your server.');
870 $this->tabs_gui->setSubTabActive(
'ldap_settings');
874 return $this->tpl->setContent($this->form_gui->getHtml());
879 $this->form_gui->setValuesByArray(array(
880 'active' => $this->server->isActive(),
881 'ds' => !$this->server->isAuthenticationEnabled(),
882 'server_name' => $this->server->getName(),
883 'server_url' => $this->server->getUrlString(),
884 'version' => $this->server->getVersion(),
885 'base_dn' => $this->server->getBaseDN(),
886 'referrals' => $this->server->isActiveReferrer(),
887 'tls' => $this->server->isActiveTLS(),
888 'binding_type' => $this->server->getBindingType(),
889 'bind_dn' => $this->server->getBindUser(),
890 'bind_pass' => $this->server->getBindPassword(),
891 'bind_pass_retype' => $this->server->getBindPassword(),
892 'search_base' => $this->server->getSearchBase(),
893 'user_scope' => $this->server->getUserScope(),
894 'user_attribute' => $this->server->getUserAttribute(),
895 'filter' => $this->server->getFilter(),
896 'group_dn' => $this->server->getGroupDN(),
897 'group_scope' => $this->server->getGroupScope(),
898 'group_filter' => $this->server->getGroupFilter(),
899 'group_member' => $this->server->getGroupMember(),
900 'memberisdn' => $this->server->enabledGroupMemberIsDN(),
901 'group' => $this->server->getGroupName(),
902 'group_attribute' => $this->server->getGroupAttribute(),
903 'group_optional' => $this->server->isMembershipOptional(),
904 'group_user_filter' => $this->server->getGroupUserFilter(),
905 'sync_on_login' => $this->server->enabledSyncOnLogin(),
906 'sync_per_cron' => $this->server->enabledSyncPerCron(),
908 'migration' => (
int)$this->server->isAccountMigrationEnabled(),
914 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
917 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'save'));
918 $this->form_gui->setTitle($this->lng->txt(
'ldap_configure'));
922 $this->form_gui->addItem($active);
926 $ds->setInfo($this->lng->txt(
'ldap_as_ds_info'));
927 $this->form_gui->addItem($ds);
929 $servername =
new ilTextInputGUI($this->lng->txt(
'ldap_server_name'),
'server_name');
931 $servername->setInfo($this->lng->txt(
'ldap_server_name_info'));
932 $servername->setSize(32);
933 $servername->setMaxLength(32);
934 $this->form_gui->addItem($servername);
936 $serverurl =
new ilTextInputGUI($this->lng->txt(
'ldap_server'),
'server_url');
938 $serverurl->setInfo($this->lng->txt(
'ldap_server_url_info'));
939 $serverurl->setSize(64);
940 $serverurl->setMaxLength(255);
941 $this->form_gui->addItem($serverurl);
943 $version =
new ilSelectInputGUI($this->lng->txt(
'ldap_version'),
'version');
945 $version->setInfo($this->lng->txt(
'ldap_server_version_info'));
946 $this->form_gui->addItem($version);
948 $basedsn =
new ilTextInputGUI($this->lng->txt(
'basedn'),
'base_dn');
950 $basedsn->setSize(64);
951 $basedsn->setMaxLength(255);
952 $this->form_gui->addItem($basedsn);
956 $referrals->setInfo($this->lng->txt(
'ldap_referrals_info'));
957 $this->form_gui->addItem($referrals);
960 $section_security->setTitle($this->lng->txt(
'ldap_server_security_settings'));
961 $this->form_gui->addItem($section_security);
965 $this->form_gui->addItem($tls);
969 $binding->addOption($anonymous);
971 $dn =
new ilTextInputGUI($this->lng->txt(
'ldap_server_bind_dn'),
'bind_dn');
973 $dn->setMaxLength(255);
977 $pass->setMaxLength(36);
978 $user->addSubItem(
$pass);
979 $binding->addOption($user);
980 $this->form_gui->addItem($binding);
983 $section_auth->setTitle($this->lng->txt(
'ldap_authentication_settings'));
984 $this->form_gui->addItem($section_auth);
986 $search_base =
new ilTextInputGUI($this->lng->txt(
'ldap_user_dn'),
'search_base');
987 $search_base->
setInfo($this->lng->txt(
'ldap_search_base_info'));
988 $search_base->setSize(64);
989 $search_base->setMaxLength(255);
990 $this->form_gui->addItem($search_base);
992 $user_scope =
new ilSelectInputGUI($this->lng->txt(
'ldap_user_scope'),
'user_scope');
995 $user_scope->setInfo($this->lng->txt(
'ldap_user_scope_info'));
996 $this->form_gui->addItem($user_scope);
998 $user_attribute =
new ilTextInputGUI($this->lng->txt(
'ldap_user_attribute'),
'user_attribute');
1000 $user_attribute->setMaxLength(64);
1001 $user_attribute->setRequired(
true);
1002 $this->form_gui->addItem($user_attribute);
1004 $filter =
new ilTextInputGUI($this->lng->txt(
'ldap_search_filter'),
'filter');
1005 $filter->
setInfo($this->lng->txt(
'ldap_filter_info'));
1006 $filter->setSize(64);
1007 $filter->setMaxLength(512);
1008 $this->form_gui->addItem($filter);
1011 $section_restrictions->setTitle($this->lng->txt(
'ldap_group_restrictions'));
1012 $this->form_gui->addItem($section_restrictions);
1014 $group_dn =
new ilTextInputGUI($this->lng->txt(
'ldap_group_search_base'),
'group_dn');
1015 $group_dn->
setInfo($this->lng->txt(
'ldap_group_dn_info'));
1016 $group_dn->setSize(64);
1017 $group_dn->setMaxLength(255);
1018 $this->form_gui->addItem($group_dn);
1020 $group_scope =
new ilSelectInputGUI($this->lng->txt(
'ldap_group_scope'),
'group_scope');
1023 $group_scope->setInfo($this->lng->txt(
'ldap_group_scope_info'));
1024 $this->form_gui->addItem($group_scope);
1026 $group_filter =
new ilTextInputGUI($this->lng->txt(
'ldap_group_filter'),
'group_filter');
1027 $group_filter->
setInfo($this->lng->txt(
'ldap_group_filter_info'));
1028 $group_filter->setSize(64);
1029 $group_filter->setMaxLength(255);
1030 $this->form_gui->addItem($group_filter);
1032 $group_member =
new ilTextInputGUI($this->lng->txt(
'ldap_group_member'),
'group_member');
1033 $group_member->
setInfo($this->lng->txt(
'ldap_group_member_info'));
1034 $group_member->setSize(32);
1035 $group_member->setMaxLength(255);
1036 $this->form_gui->addItem($group_member);
1039 $group_member_isdn =
new ilCheckboxInputGUI($this->lng->txt(
'ldap_memberisdn'),
'memberisdn');
1040 #$group_member_isdn->setInfo($this->lng->txt('ldap_group_member_info'));
1041 $this->form_gui->addItem($group_member_isdn);
1042 #$group_member->addSubItem($group_member_isdn);
1044 $group =
new ilTextInputGUI($this->lng->txt(
'ldap_group_name'),
'group');
1045 $group->
setInfo($this->lng->txt(
'ldap_group_name_info'));
1046 $group->setSize(32);
1047 $group->setMaxLength(255);
1048 $this->form_gui->addItem($group);
1050 $group_atrr =
new ilTextInputGUI($this->lng->txt(
'ldap_group_attribute'),
'group_attribute');
1051 $group_atrr->
setInfo($this->lng->txt(
'ldap_group_attribute_info'));
1052 $group_atrr->setSize(16);
1053 $group_atrr->setMaxLength(64);
1054 $this->form_gui->addItem($group_atrr);
1056 $group_optional =
new ilCheckboxInputGUI($this->lng->txt(
'ldap_group_membership'),
'group_optional');
1057 $group_optional->
setOptionTitle($this->lng->txt(
'ldap_group_member_optional'));
1058 $group_optional->setInfo($this->lng->txt(
'ldap_group_optional_info'));
1059 $group_optional->setValue(1);
1060 $group_user_filter =
new ilTextInputGUI($this->lng->txt(
'ldap_group_user_filter'),
'group_user_filter');
1061 $group_user_filter->
setSize(64);
1062 $group_user_filter->setMaxLength(255);
1063 $group_optional->addSubItem($group_user_filter);
1064 $this->form_gui->addItem($group_optional);
1067 $section_sync->setTitle($this->lng->txt(
'ldap_user_sync'));
1068 $this->form_gui->addItem($section_sync);
1071 $sync_on_login =
new ilCheckboxInputGUI($this->lng->txt(
'ldap_sync_login'),
'sync_on_login');
1072 $sync_on_login->setValue(1);
1074 $sync_per_cron =
new ilCheckboxInputGUI($this->lng->txt(
'ldap_sync_cron'),
'sync_per_cron');
1076 $ci_gui->addSubItem($sync_per_cron);
1077 $ci_gui->setInfo($this->lng->txt(
'ldap_user_sync_info'));
1078 $this->form_gui->addItem($ci_gui);
1080 $global_role =
new ilSelectInputGUI($this->lng->txt(
'ldap_global_role_assignment'),
'global_role');
1082 $global_role->setInfo($this->lng->txt(
'ldap_global_role_info'));
1083 $this->form_gui->addItem($global_role);
1086 $migr->
setInfo($this->lng->txt(
'auth_ldap_migration_info'));
1088 $this->form_gui->addItem($migr);
1090 $this->form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
1101 $this->tabs_gui->setSubTabActive(
'ldap_settings');
1104 if($this->form_gui->checkInput())
1106 $this->server->toggleActive((
int)$this->form_gui->getInput(
'active'));
1107 $this->server->enableAuthentication(!$this->form_gui->getInput(
'ds'));
1108 $this->server->setName($this->form_gui->getInput(
'server_name'));
1109 $this->server->setUrl($this->form_gui->getInput(
'server_url'));
1110 $this->server->setVersion($this->form_gui->getInput(
'version'));
1111 $this->server->setBaseDN($this->form_gui->getInput(
'base_dn'));
1112 $this->server->toggleReferrer($this->form_gui->getInput(
'referrals'));
1113 $this->server->toggleTLS($this->form_gui->getInput(
'tls'));
1114 $this->server->setBindingType((
int)$this->form_gui->getInput(
'binding_type'));
1115 $this->server->setBindUser($this->form_gui->getInput(
'bind_dn'));
1116 $this->server->setBindPassword($this->form_gui->getInput(
'bind_pass'));
1117 $this->server->setSearchBase($this->form_gui->getInput(
'search_base'));
1118 $this->server->setUserScope($this->form_gui->getInput(
'user_scope'));
1119 $this->server->setUserAttribute($this->form_gui->getInput(
'user_attribute'));
1120 $this->server->setFilter($this->form_gui->getInput(
'filter'));
1121 $this->server->setGroupDN($this->form_gui->getInput(
'group_dn'));
1122 $this->server->setGroupScope((
int)$this->form_gui->getInput(
'group_scope'));
1123 $this->server->setGroupFilter($this->form_gui->getInput(
'group_filter'));
1124 $this->server->setGroupMember($this->form_gui->getInput(
'group_member'));
1125 $this->server->enableGroupMemberIsDN((
int)$this->form_gui->getInput(
'memberisdn'));
1126 $this->server->setGroupName($this->form_gui->getInput(
'group'));
1127 $this->server->setGroupAttribute($this->form_gui->getInput(
'group_attribute'));
1128 $this->server->setGroupUserFilter($this->form_gui->getInput(
'group_user_filter'));
1129 $this->server->toggleMembershipOptional((
int)$this->form_gui->getInput(
'group_optional'));
1130 $this->server->enableSyncOnLogin((
int)$this->form_gui->getInput(
'sync_on_login'));
1131 $this->server->enableSyncPerCron((
int)$this->form_gui->getInput(
'sync_per_cron'));
1132 $this->server->setGlobalRole((
int)$this->form_gui->getInput(
'global_role'));
1133 $this->server->enableAccountMigration((
int)$this->form_gui->getInput(
'migration'));
1135 if(!$this->server->validate())
1138 $this->form_gui->setValuesByPost();
1139 return $this->tpl->setContent($this->form_gui->getHtml());
1143 if($this->server->getServerId())
1145 $this->server->update();
1149 $_GET[
'ldap_server_id'] = $this->server->create();
1154 $this->mapping->setRule(
'global_role', (
int)$this->form_gui->getInput(
'global_role'),
false);
1155 $this->mapping->save();
1158 $this->ctrl->redirect($this,
'serverList');
1160 #$this->form_gui->setValuesByPost();
1161 #return $this->tpl->setContent($this->form_gui->getHtml());
1164 $this->form_gui->setValuesByPost();
1165 return $this->tpl->setContent($this->form_gui->getHtml());
1177 $this->tabs_gui->addSubTabTarget(
"ldap_settings",
1178 $this->ctrl->getLinkTarget($this,
'serverList'),
1179 "serverList",get_class($this));
1182 include_once(
'Services/LDAP/classes/class.ilLDAPServer.php');
1188 $this->tabs_gui->addSubTabTarget(
"ldap_user_mapping",
1189 $this->ctrl->getLinkTarget($this,
'userMapping'),
1190 "userMapping",get_class($this));
1192 $this->tabs_gui->addSubTabTarget(
'ldap_role_assignments',
1193 $this->ctrl->getLinkTarget($this,
'roleAssignments'),
1194 "roleAssignments",get_class($this));
1196 $this->tabs_gui->addSubTabTarget(
"ldap_role_mapping",
1197 $this->ctrl->getLinkTarget($this,
'roleMapping'),
1198 "roleMapping",get_class($this));
1205 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
1206 if(!
$_GET[
'ldap_server_id'])
1215 include_once
'./Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
1221 include_once
'./Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php';
1232 global $rbacreview,$ilObjDataCache;
1239 $select[0] = $this->lng->txt(
'links_select_one');
1240 foreach($global_roles as $role_id)
1256 global $rbacreview,$ilObjDataCache;
1258 include_once(
'./Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
1265 $select[0] = $this->lng->txt(
'links_select_one');
1266 foreach($global_roles as $role_id)
1274 'global_role',$select,
false,
true);
1285 return array(
'gender' => $this->lng->txt(
'gender'),
1286 'firstname' => $this->lng->txt(
'firstname'),
1287 'lastname' => $this->lng->txt(
'lastname'),
1288 'title' => $this->lng->txt(
'person_title'),
1289 'institution' => $this->lng->txt(
'institution'),
1290 'department' => $this->lng->txt(
'department'),
1291 'street' => $this->lng->txt(
'street'),
1292 'city' => $this->lng->txt(
'city'),
1293 'zipcode' => $this->lng->txt(
'zipcode'),
1294 'country' => $this->lng->txt(
'country'),
1295 'phone_office' => $this->lng->txt(
'phone_office'),
1296 'phone_home' => $this->lng->txt(
'phone_home'),
1297 'phone_mobile' => $this->lng->txt(
'phone_mobile'),
1298 'fax' => $this->lng->txt(
'fax'),
1299 'email' => $this->lng->txt(
'email'),
1300 'hobby' => $this->lng->txt(
'hobby'),
1301 'matriculation' => $this->lng->txt(
'matriculation'));
1302 #'photo' => $this->lng->txt('photo'));
1307 include_once(
"./Services/User/classes/class.ilUserDefinedFields.php");
1313 return ilUtil::formSelect(
$_POST[
'mapping_template'],
'mapping_template',array(0 => $this->lng->txt(
'ldap_mapping_template'),
1314 "inetOrgPerson" =>
'inetOrgPerson',
1315 "organizationalPerson" =>
'organizationalPerson',
1316 "person" =>
'person',
1317 "ad_2003" =>
'Active Directory (Win 2003)'),
false,
true);
1330 if(!isset(
$_GET[
'mapping_id']))
1332 return $a_mapping_data;
1334 $mapping_id =
$_GET[
'mapping_id'];
1335 $a_mapping_data[0] = $a_mapping_data[$mapping_id];
1337 return $a_mapping_data;
1348 if(!isset(
$_SESSION[
'ldap_mapping_details']))
1350 $_SESSION[
'ldap_mapping_details'] = array();
1352 if(isset(
$_GET[
'details_show']))
1354 $_SESSION[
'ldap_mapping_details'][
$_GET[
'details_show']] = $_GET[
'details_show'];
1356 if(isset(
$_GET[
'details_hide']))
1371 global $rbacreview,$ilObjDataCache;
1373 $new_mapping = array();
1374 $new_mapping = array();
1375 foreach($a_mapping_data as $mapping_id =>
$data)
1377 $new_mapping[$mapping_id] =
$data;
1378 $new_mapping[$mapping_id][
'obj_id'] = $obj_id = $rbacreview->getObjectOfRole(
$data[
'role']);
1379 $new_mapping[$mapping_id][
'obj_title'] = $ilObjDataCache->lookupTitle($obj_id);
1380 $new_mapping[$mapping_id][
'mapping_id'] = $mapping_id;
1396 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
1397 include_once(
'Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
1400 $this->form->setFormAction($this->ctrl->getFormAction($this));
1405 $this->form->setTitle($this->lng->txt(
'ldap_edit_role_ass_rule'));
1406 $this->form->addCommandButton(
'updateRoleAssignment',$this->lng->txt(
'save'));
1407 $this->form->addCommandButton(
'roleAssignments',$this->lng->txt(
'cancel'));
1410 $this->form->setTitle($this->lng->txt(
'ldap_add_role_ass_rule'));
1411 $this->form->addCommandButton(
'addRoleAssignment',$this->lng->txt(
'ldap_btn_add_role_ass'));
1412 $this->form->addCommandButton(
'roleAssignments',$this->lng->txt(
'cancel'));
1420 $global =
new ilRadioOption($this->lng->txt(
'ldap_global_role'),0);
1421 $role->addOption($global);
1425 $global->addSubItem($role_select);
1427 $local =
new ilRadioOption($this->lng->txt(
'ldap_local_role'),1);
1428 $role->addOption($local);
1430 include_once
'./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php';
1432 $role_search->setSize(40);
1433 $local->addSubItem($role_search);
1435 $role->setInfo($this->lng->txt(
'ldap_role_name_info'));
1436 $this->form->addItem($role);
1440 $update->
setValue($this->lng->txt(
'ldap_check_role_assignment'));
1443 $add->setOptionTitle($this->lng->txt(
'ldap_add_missing'));
1444 $update->addSubItem($add);
1447 $remove->setOptionTitle($this->lng->txt(
'ldap_remove_deprecated'));
1448 $update->addSubItem($remove);
1450 $this->form->addItem($update);
1456 #$group->setValue($current_rule->getType());
1463 #$dn->setValue($current_rule->getDN());
1465 $dn->setMaxLength(512);
1466 $dn->
setInfo($this->lng->txt(
'ldap_role_grp_dn_info'));
1467 $radio_group->addSubItem($dn);
1468 $at =
new ilTextInputGUI($this->lng->txt(
'ldap_role_grp_at'),
'at');
1469 #$at->setValue($current_rule->getMemberAttribute());
1471 $at->setMaxLength(128);
1472 $radio_group->addSubItem($at);
1474 #$isdn->setChecked($current_rule->isMemberAttributeDN());
1475 $isdn->
setInfo($this->lng->txt(
'ldap_group_member_info'));
1476 $radio_group->addSubItem($isdn);
1477 $radio_group->setInfo($this->lng->txt(
'ldap_role_grp_info'));
1479 $group->addOption($radio_group);
1483 $name =
new ilTextInputGUI($this->lng->txt(
'ldap_role_at_name'),
'name');
1484 #$name->setValue($current_rule->getAttributeName());
1486 $name->setMaxLength(128);
1487 #$name->setInfo($this->lng->txt('ldap_role_at_name_info'));
1491 $val =
new ilTextInputGUI($this->lng->txt(
'ldap_role_at_value'),
'value');
1492 #$val->setValue($current_rule->getAttributeValue());
1494 $val->setMaxLength(128);
1495 #$val->setInfo($this->lng->txt('ldap_role_at_value_info'));
1496 $radio_attribute->addSubItem($val);
1497 $radio_attribute->setInfo($this->lng->txt(
'ldap_role_at_info'));
1499 $group->addOption($radio_attribute);
1504 $pl->
setInfo($this->lng->txt(
'ldap_plugin_info'));
1505 $pl->setDisabled(!$pl_active);
1510 $id->setMaxLength(3);
1511 $id->setMaxValue(999);
1512 $id->setMinValue(1);
1513 $pl->addSubItem($id);
1515 $group->addOption($pl);
1516 $this->form->addItem($group);
1525 global $ilPluginAdmin;
1527 return count($ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
'LDAP',
'ldaphk')) ?
true :
false;
1536 include_once(
"./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php");