19declare(strict_types=1);
64 private readonly \ILIAS\HTTP\GlobalHttpState
$http;
73 $this->
ctrl = $DIC->ctrl();
74 $this->tabs_gui =
$DIC->tabs();
75 $this->
lng = $DIC->language();
76 $this->
lng->loadLanguageModule(
'ldap');
77 $this->
lng->loadLanguageModule(
'ui');
78 $this->ilErr =
$DIC[
'ilErr'];
80 $this->component_repository =
$DIC[
'component.repository'];
81 $this->rbacReview =
$DIC->rbac()->review();
82 $this->rbacSystem =
$DIC->rbac()->system();
83 $this->
toolbar = $DIC->toolbar();
84 $this->main_tpl =
$DIC->ui()->mainTemplate();
85 $this->
http = $DIC->http();
86 $this->ui_factory =
$DIC->ui()->factory();
87 $this->ui_renderer =
$DIC->ui()->renderer();
89 $this->object_data_cache =
$DIC[
'ilObjDataCache'];
90 $this->
profile = $DIC[
'user']->getProfile();
92 $this->tpl =
$DIC->ui()->mainTemplate();
94 $http_wrapper =
$DIC->http()->wrapper();
95 $is_post_request =
$DIC->http()->request()->getMethod() ===
'POST';
98 if ($http_wrapper->query()->has(
'rule_id')) {
99 $this->rule_id = $http_wrapper->query()->retrieve(
104 if ($http_wrapper->query()->has(
'ldap_server_id')) {
105 $this->ldap_server_id = $http_wrapper->query()->retrieve(
109 } elseif ($http_wrapper->query()->has(
'ldap_servers_server_id')) {
110 $this->ldap_server_id = $http_wrapper->query()->retrieve(
111 'ldap_servers_server_id',
113 $refinery->kindlyTo()->listOf(
116 $this->refinery->custom()->constraint(
117 fn($value):
bool => count($value) === 1,
118 $this->
lng->txt(
'select_one')
120 $this->refinery->custom()->transformation(
121 fn($value):
int => $value[0]
128 if ($http_wrapper->query()->has(
'mapping_id')) {
129 $this->mapping_id = $http_wrapper->query()->retrieve(
134 if ($http_wrapper->query()->has(
'ldap_role_mapping_mapping_ids')) {
135 $this->mappings = $http_wrapper->query()->retrieve(
136 'ldap_role_mapping_mapping_ids',
139 if ($this->mappings === [
'ALL_OBJECTS']) {
141 $this->mappings = array_map(
static function (array
$mapping):
int {
143 }, $mapping_instance->getMappings());
145 $this->mappings = $this->
refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->int())->transform($this->mappings);
146 if (count($this->mappings) === 1) {
147 $this->mapping_id = current($this->mappings);
150 if ($http_wrapper->query()->has(
'ldap_role_assignment_rule_ids')) {
151 $this->rule_ids = $http_wrapper->query()->retrieve(
152 'ldap_role_assignment_rule_ids',
155 if ($this->rule_ids === [
'ALL_OBJECTS']) {
161 $this->rule_ids = $this->
refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->int())->transform($this->rule_ids);
162 if (count($this->rule_ids) === 1) {
163 $this->rule_id = current($this->rule_ids);
166 if ($is_post_request) {
167 if ($http_wrapper->post()->has(
'rule_ids')) {
168 $this->rule_ids = $http_wrapper->post()->retrieve(
173 if ($http_wrapper->post()->has(
'role_id')) {
174 $this->role_id = $http_wrapper->post()->retrieve(
179 if ($http_wrapper->post()->has(
'rule_id')) {
180 $this->rule_id = $http_wrapper->post()->retrieve(
185 if ($http_wrapper->post()->has(
'mappings')) {
186 $this->mappings = $http_wrapper->post()->retrieve(
191 if ($http_wrapper->post()->has(
'server_ids')) {
192 $this->server_ids = $http_wrapper->post()->retrieve(
197 if ($http_wrapper->post()->has(
'mapping_template')) {
198 $this->mapping_template = $http_wrapper->post()->retrieve(
203 if ($http_wrapper->post()->has(
'role_bind_user')) {
209 if ($http_wrapper->post()->has(
'role_bind_pass')) {
215 if ($http_wrapper->post()->has(
'role_sync_active')) {
216 $this->role_sync_active = $http_wrapper->post()->retrieve(
222 if ($http_wrapper->post()->has($key .
'_value')) {
226 )), $http_wrapper->post()->has($key .
'_update')];
228 $this->attribute_mappings[$key] = [
'',
false];
233 $this->ref_id = $a_auth_ref_id;
235 if ($this->
ctrl->getCmd() !==
'addServerSettings') {
236 $this->
ctrl->setParameter($this,
'ldap_server_id', $this->ldap_server_id);
242 $cmd = $this->
ctrl->getCmd();
244 if ($cmd ===
null || $cmd ===
'' || !method_exists($this, $cmd .
'Cmd')) {
248 if (!$this->rbacSystem->checkAccess(
'read', $this->ref_id)) {
249 $this->ilErr->raiseError($this->
lng->txt(
'permission_denied'), $this->ilErr->WARNING);
252 $verified_command = $cmd .
'Cmd';
253 $this->$verified_command();
261 $this->ilErr->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->ilErr->WARNING);
274 foreach ($this->
profile->getFields() as $field) {
275 if (!$field->isCustom()) {
279 $keys[] =
'udf_' . $field->getIdentifier();
294 $this->tabs_gui->activateTab(
'role_assignments');
296 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ldap_role_assignments.html',
'components/ILIAS/LDAP');
300 $this->tpl->setVariable(
'NEW_ASSIGNMENT_TBL', $this->
form->getHTML());
304 $this->tpl->setVariable(
'RULES_TBL', $this->ui_renderer->render($this->getRoleAssignmentTable()));
310 if (!$this->rule_id) {
311 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
317 $this->tabs_gui->activateTab(
'role_assignments');
319 $this->
ctrl->setParameter($this,
'rule_id', $this->rule_id);
325 $this->tpl->setContent($this->
form->getHTML());
330 $role_id = $this->role_mapping_rule->getRoleId();
331 if ($this->rbacReview->isGlobalRole(
$role_id)) {
332 $val[
'role_name'] = 0;
335 $val[
'role_name'] = 1;
338 $val[
'add_missing'] = (
int) $this->role_mapping_rule->isAddOnUpdateEnabled();
339 $val[
'remove_deprecated'] = (
int) $this->role_mapping_rule->isRemoveOnUpdateEnabled();
340 $val[
'type'] = $this->role_mapping_rule->getType();
341 $val[
'dn'] = $this->role_mapping_rule->getDN();
342 $val[
'at'] = $this->role_mapping_rule->getMemberAttribute();
343 $val[
'isdn'] = $this->role_mapping_rule->isMemberAttributeDN();
344 $val[
'name'] = $this->role_mapping_rule->getAttributeName();
345 $val[
'value'] = $this->role_mapping_rule->getAttributeValue();
346 $val[
'plugin_id'] = $this->role_mapping_rule->getPluginId();
348 $this->
form->setValuesByArray($val);
354 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
361 $formWithoutErrors = $this->
form->checkInput();
363 if (!$formWithoutErrors || $roleErrorMessage !==
'') {
364 if ($roleErrorMessage !==
'') {
365 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt($roleErrorMessage));
368 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ldap_role_assignments.html',
'components/ILIAS/LDAP');
370 $this->
form->setValuesByPost();
371 $this->tpl->setVariable(
'NEW_ASSIGNMENT_TBL', $this->
form->getHTML());
372 $this->tabs_gui->activateSubTab(
'role_assignments');
377 $this->
ctrl->redirect($this,
'showRoleSelection');
379 $this->rule->update();
381 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
382 $this->
ctrl->redirect($this,
'roleAssignments');
390 if (!$this->rule_ids) {
391 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
397 $this->tabs_gui->activateTab(
'role_assignments');
400 $c_gui->setFormAction($this->
ctrl->getFormAction($this,
'deleteRules'));
401 $c_gui->setHeaderText($this->
lng->txt(
'ldap_confirm_del_role_ass'));
402 $c_gui->setCancel($this->
lng->txt(
'cancel'),
'roleAssignments');
403 $c_gui->setConfirm($this->
lng->txt(
'confirm'),
'deleteRules');
404 foreach ($this->rule_ids as
$rule_id) {
409 $this->tpl->setContent($c_gui->getHTML());
416 if (!$this->rule_ids) {
417 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_once'));
422 foreach ($this->rule_ids as
$rule_id) {
427 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'ldap_deleted_rule'),
true);
428 $this->
ctrl->redirect($this,
'roleAssignments');
434 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'));
442 $formWithoutErrors = $this->
form->checkInput();
444 if (!$formWithoutErrors || $roleErrorMessage !==
'') {
445 if ($roleErrorMessage !==
'') {
446 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt($roleErrorMessage));
449 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ldap_role_assignments.html',
'components/ILIAS/LDAP');
451 $this->
form->setValuesByPost();
452 $this->tpl->setVariable(
'NEW_ASSIGNMENT_TBL', $this->
form->getHTML());
453 $this->tpl->setVariable(
'RULES_TBL', $this->ui_renderer->render($this->getRoleAssignmentTable()));
454 $this->tabs_gui->activateSubTab(
'role_assignments');
459 $this->
ctrl->redirect($this,
'showRoleSelection');
461 $this->rule->create();
463 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
464 $this->
ctrl->redirect($this,
'roleAssignments');
470 if ($this->rule->getRoleId() > 0) {
476 $rule[
'rule_id'] = $this->rule_id ?: 0;
477 $rule[
'role_search'] = $this->
form->getInput(
'role_search');
478 $rule[
'add_on_update'] = $this->
form->getInput(
'add_missing');
479 $rule[
'remove_on_update'] = $this->
form->getInput(
'remove_deprecated');
480 $rule[
'type'] = $this->
form->getInput(
'type');
481 $rule[
'dn'] = $this->
form->getInput(
'dn');
482 $rule[
'at'] = $this->
form->getInput(
'at');
483 $rule[
'isdn'] = $this->
form->getInput(
'isdn');
484 $rule[
'name'] = $this->
form->getInput(
'name');
485 $rule[
'value'] = $this->
form->getInput(
'value');
486 $rule[
'plugin'] = $this->
form->getInput(
'plugin_id');
488 $this->
ctrl->saveParameter($this,
'rule_id');
498 $this->tabs_gui->activateTab(
'role_assignments');
499 $this->
ctrl->saveParameter($this,
'rule_id');
502 $parser->setMinWordLength(1);
507 $object_search->setFilter([
'role']);
508 $res = $object_search->performSearch();
510 $entries =
$res->getEntries();
513 $table->setTitle($this->
lng->txt(
'ldap_role_selection'));
514 if ($this->rbacSystem->checkAccess(
'write', $this->ref_id)) {
515 $table->addMultiCommand(
'saveRoleSelection', $this->
lng->txt(
'ldap_choose_role'));
517 $table->parse($entries);
519 $this->tpl->setContent($table->getHTML());
525 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
530 if (!$this->role_id) {
531 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
537 $this->rule->setRoleId($this->role_id);
539 if ($this->rule_id) {
540 $this->rule->update();
542 $this->rule->create();
545 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
546 $this->
ctrl->setParameter($this,
'rule_id',
null);
547 $this->
ctrl->redirect($this,
'roleAssignments');
553 $this->rule->validate();
555 return $this->ilErr->getMessage();
563 $this->
http->request(),
570 $this->server->getServerId(),
571 $this->rbacSystem->checkAccess(
'write', $this->ref_id)
580 if (is_object($this->rule)) {
586 if ($load_from_form) {
587 if ($this->
form->getInput(
'role_name') ===
'0') {
588 $this->rule->setRoleId((
int) $this->
form->getInput(
'role_id'));
589 } elseif ($this->
form->getInput(
'role_search')) {
593 $parser->setMinWordLength(1);
598 $object_search->setFilter([
'role']);
599 $res = $object_search->performSearch();
601 $entries =
$res->getEntries();
602 if (count($entries) === 1) {
603 $role = current($entries);
604 $this->rule->setRoleId($role[
'obj_id']);
605 } elseif (count($entries) > 1) {
606 $this->rule->setRoleId(-1);
610 $this->rule->setAttributeName($this->
form->getInput(
'name'));
611 $this->rule->setAttributeValue($this->
form->getInput(
'value'));
612 $this->rule->setDN($this->
form->getInput(
'dn'));
613 $this->rule->setMemberAttribute($this->
form->getInput(
'at'));
614 $this->rule->setMemberIsDN((
bool) $this->
form->getInput(
'isdn'));
615 $this->rule->enableAddOnUpdate((
bool) $this->
form->getInput(
'add_missing'));
616 $this->rule->enableRemoveOnUpdate((
bool) $this->
form->getInput(
'remove_deprecated'));
617 $this->rule->setPluginId((
int) $this->
form->getInput(
'plugin_id'));
618 $this->rule->setType((
int) $this->
form->getInput(
'type'));
619 $this->rule->setServerId($this->
getServer()->getServerId());
623 $this->rule->setServerId($this->
getServer()->getServerId());
626 $this->rule->enableAddOnUpdate((
bool) (
$rule[
'add_on_update'] ??
false));
627 $this->rule->enableRemoveOnUpdate((
bool) (
$rule[
'remove_on_update'] ??
false));
643 if (!$this->mappings) {
644 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
654 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'ldap_deleted_role_mapping'));
662 if (!$this->mapping_template) {
668 $this->mapping->clearRules();
671 $this->mapping->setRule($key, $value,
false);
681 $this->tabs_gui->activateTab(
'role_mapping');
684 $this->mapping->setRule(
686 $this->attribute_mappings[$key][0],
687 $this->attribute_mappings[$key][1]
690 foreach ($this->
profile->getFields() as $field) {
691 if (!$field->isCustom()) {
695 $key =
'udf_' . $field->getIdentifier();
696 $this->mapping->setRule(
698 $this->attribute_mappings[$key][0],
699 $this->attribute_mappings[$key][1]
703 $this->mapping->save();
706 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
711 return $this->
http->wrapper()->query()->retrieve(
712 'ldap_servers_table_action',
714 $this->refinery->kindlyTo()->string(),
715 $this->refinery->always(
'')
727 default => $this->
ctrl->redirect($this,
'serverList')
733 return $this->
http->wrapper()->query()->retrieve(
734 'ldap_role_assignment_table_action',
736 $this->refinery->kindlyTo()->string(),
737 $this->refinery->always(
'')
747 default => $this->
ctrl->redirect($this,
'serverList')
753 return $this->
http->wrapper()->query()->retrieve(
754 'ldap_role_mapping_table_action',
756 $this->refinery->kindlyTo()->string(),
757 $this->refinery->always(
'')
768 default => $this->
ctrl->redirect($this,
'serverList'),
774 if (!$this->rbacSystem->checkAccess(
'read', $this->ref_id)) {
775 $this->ilErr->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->ilErr->WARNING);
779 $this->main_tpl->setOnScreenMessage(
'failure',
'Missing LDAP libraries. Please ensure that the PHP LDAP module is installed on your server.');
782 if ($this->rbacSystem->checkAccess(
'write', $this->ref_id)) {
784 $this->
lng->txt(
'add_ldap_server'),
785 $this->ctrl->getLinkTarget($this,
'addServerSettings')
789 $this->
ctrl->setParameter($this,
'ldap_server_id',
null);
791 $table = new \ILIAS\LDAP\Server\UI\ServerTable(
798 $this->
http->request(),
803 $this->rbacSystem->checkAccess(
'write', $this->ref_id),
804 $this->rbacSystem->checkAccess(
'read', $this->ref_id)
807 $this->tpl->setContent($this->ui_renderer->render($table->getComponent()));
812 $this->form_gui->setValuesByArray([
813 'active' => $this->
server->isActive(),
814 'ds' => !$this->server->isAuthenticationEnabled(),
815 'server_name' => $this->server->getName(),
816 'server_url' => $this->server->getUrlString(),
817 'version' => $this->server->getVersion(),
818 'base_dn' => $this->server->getBaseDN(),
819 'referrals' => $this->server->isActiveReferrer(),
820 'tls' => $this->server->isActiveTLS(),
821 'binding_type' => $this->server->getBindingType(),
822 'bind_dn' => $this->server->getBindUser(),
823 'bind_pass' => $this->server->getBindPassword(),
824 'bind_pass_retype' => $this->server->getBindPassword(),
825 'search_base' => $this->server->getSearchBase(),
826 'user_scope' => $this->server->getUserScope(),
827 'user_attribute' => $this->server->getUserAttribute(),
828 'filter' => $this->server->getFilter(),
829 'group_dn' => $this->server->getGroupDN(),
830 'group_scope' => $this->server->getGroupScope(),
831 'group_filter' => $this->server->getGroupFilter(),
832 'group_member' => $this->server->getGroupMember(),
833 'memberisdn' => $this->server->enabledGroupMemberIsDN(),
834 'group' => $this->server->getGroupName(),
835 'group_attribute' => $this->server->getGroupAttribute(),
836 'group_optional' => $this->server->isMembershipOptional(),
837 'group_user_filter' => $this->server->getGroupUserFilter(),
838 'sync_on_login' => $this->server->enabledSyncOnLogin(),
839 'sync_per_cron' => $this->server->enabledSyncPerCron(),
841 'migration' => (
int) $this->server->isAccountMigrationEnabled(),
842 'name_filter' => $this->server->getUsernameFilter(),
843 'escape_dn' => $this->server->enabledEscapeDN()
850 $this->form_gui->setFormAction($this->
ctrl->getFormAction($this,
'save'));
851 $this->form_gui->setTitle($this->
lng->txt(
'ldap_configure'));
854 $active->setValue(
'1');
855 $this->form_gui->addItem($active);
859 $ds->setInfo($this->
lng->txt(
'ldap_as_ds_info'));
860 $this->form_gui->addItem($ds);
862 $servername =
new ilTextInputGUI($this->
lng->txt(
'ldap_server_name'),
'server_name');
863 $servername->setRequired(
true);
864 $servername->setInfo($this->
lng->txt(
'ldap_server_name_info'));
865 $servername->setSize(32);
866 $servername->setMaxLength(32);
867 $this->form_gui->addItem($servername);
869 $namefilter =
new ilTextInputGUI($this->
lng->txt(
'ldap_username_filter'),
'name_filter');
870 $namefilter->setInfo($this->
lng->txt(
'ldap_username_filter_info'));
871 $namefilter->setSize(64);
872 $namefilter->setMaxLength(255);
873 $this->form_gui->addItem($namefilter);
876 $serverurl->setRequired(
true);
877 $serverurl->setInfo($this->
lng->txt(
'ldap_server_url_info'));
878 $serverurl->setSize(64);
879 $serverurl->setMaxLength(255);
880 $this->form_gui->addItem($serverurl);
883 $version->setOptions([2 => 2, 3 => 3]);
884 $version->setInfo($this->
lng->txt(
'ldap_server_version_info'));
888 $basedsn->setRequired(
true);
889 $basedsn->setSize(64);
890 $basedsn->setMaxLength(255);
891 $this->form_gui->addItem($basedsn);
894 $referrals->setValue(
'1');
895 $referrals->setInfo($this->
lng->txt(
'ldap_referrals_info'));
896 $this->form_gui->addItem($referrals);
899 $section_security->setTitle($this->
lng->txt(
'ldap_server_security_settings'));
900 $this->form_gui->addItem($section_security);
904 $this->form_gui->addItem($tls);
908 $binding->addOption($anonymous);
912 $dn->setMaxLength(255);
913 $user->addSubItem($dn);
915 $pass->setSkipSyntaxCheck(
true);
917 $pass->setMaxLength(100);
918 $user->addSubItem($pass);
919 $binding->addOption($user);
920 $this->form_gui->addItem($binding);
923 $section_auth->setTitle($this->
lng->txt(
'ldap_authentication_settings'));
924 $this->form_gui->addItem($section_auth);
926 $search_base =
new ilTextInputGUI($this->
lng->txt(
'ldap_user_dn'),
'search_base');
927 $search_base->setInfo($this->
lng->txt(
'ldap_search_base_info'));
928 $search_base->setSize(64);
929 $search_base->setMaxLength(255);
930 $this->form_gui->addItem($search_base);
933 $user_scope->setOptions([
937 $user_scope->setInfo($this->
lng->txt(
'ldap_user_scope_info'));
938 $this->form_gui->addItem($user_scope);
940 $user_attribute =
new ilTextInputGUI($this->
lng->txt(
'ldap_user_attribute'),
'user_attribute');
941 $user_attribute->setSize(16);
942 $user_attribute->setMaxLength(64);
943 $user_attribute->setRequired(
true);
944 $this->form_gui->addItem($user_attribute);
947 $filter->setInfo($this->
lng->txt(
'ldap_filter_info'));
948 $filter->setSize(64);
949 $filter->setMaxLength(512);
950 $this->form_gui->addItem($filter);
953 $section_restrictions->setTitle($this->
lng->txt(
'ldap_group_restrictions'));
954 $this->form_gui->addItem($section_restrictions);
956 $group_dn =
new ilTextInputGUI($this->
lng->txt(
'ldap_group_search_base'),
'group_dn');
957 $group_dn->setInfo($this->
lng->txt(
'ldap_group_dn_info'));
958 $group_dn->setSize(64);
959 $group_dn->setMaxLength(255);
960 $this->form_gui->addItem($group_dn);
963 $group_scope->setOptions([
967 $group_scope->setInfo($this->
lng->txt(
'ldap_group_scope_info'));
968 $this->form_gui->addItem($group_scope);
970 $group_filter =
new ilTextInputGUI($this->
lng->txt(
'ldap_group_filter'),
'group_filter');
971 $group_filter->setInfo($this->
lng->txt(
'ldap_group_filter_info'));
972 $group_filter->setSize(64);
973 $group_filter->setMaxLength(255);
974 $this->form_gui->addItem($group_filter);
976 $group_member =
new ilTextInputGUI($this->
lng->txt(
'ldap_group_member'),
'group_member');
977 $group_member->setInfo($this->
lng->txt(
'ldap_group_member_info'));
978 $group_member->setSize(32);
979 $group_member->setMaxLength(255);
980 $this->form_gui->addItem($group_member);
983 $this->form_gui->addItem($group_member_isdn);
986 $escapedn->setValue(
'1');
987 $escapedn->setInfo($this->
lng->txt(
'ldap_escapedn_info'));
988 $this->form_gui->addItem($escapedn);
991 $group->setInfo($this->
lng->txt(
'ldap_group_name_info'));
993 $group->setMaxLength(255);
994 $this->form_gui->addItem($group);
996 $group_atrr =
new ilTextInputGUI($this->
lng->txt(
'ldap_group_attribute'),
'group_attribute');
997 $group_atrr->setInfo($this->
lng->txt(
'ldap_group_attribute_info'));
998 $group_atrr->setSize(16);
999 $group_atrr->setMaxLength(64);
1000 $this->form_gui->addItem($group_atrr);
1002 $group_optional =
new ilCheckboxInputGUI($this->
lng->txt(
'ldap_group_membership'),
'group_optional');
1003 $group_optional->setOptionTitle($this->
lng->txt(
'ldap_group_member_optional'));
1004 $group_optional->setInfo($this->
lng->txt(
'ldap_group_optional_info'));
1005 $group_optional->setValue(
'1');
1006 $group_user_filter =
new ilTextInputGUI($this->
lng->txt(
'ldap_group_user_filter'),
'group_user_filter');
1007 $group_user_filter->setSize(64);
1008 $group_user_filter->setMaxLength(255);
1009 $group_optional->addSubItem($group_user_filter);
1010 $this->form_gui->addItem($group_optional);
1013 $section_sync->setTitle($this->
lng->txt(
'ldap_user_sync'));
1014 $this->form_gui->addItem($section_sync);
1018 $sync_on_login->setValue(
'1');
1019 $ci_gui->addSubItem($sync_on_login);
1021 $sync_per_cron->setValue(
'1');
1022 $ci_gui->addSubItem($sync_per_cron);
1023 $ci_gui->setInfo($this->
lng->txt(
'ldap_user_sync_info'));
1024 $this->form_gui->addItem($ci_gui);
1026 $global_role =
new ilSelectInputGUI($this->
lng->txt(
'ldap_global_role_assignment'),
'global_role');
1028 $global_role->setInfo($this->
lng->txt(
'ldap_global_role_info'));
1029 $this->form_gui->addItem($global_role);
1032 $migr->setInfo($this->
lng->txt(
'auth_ldap_migration_info'));
1033 $migr->setValue(
'1');
1034 $this->form_gui->addItem($migr);
1042 if ($this->rbacSystem->checkAccess(
'write', $this->ref_id)) {
1043 $this->form_gui->addCommandButton(
'save', $this->
lng->txt(
'save'));
1045 foreach ($this->form_gui->getItems() as $item) {
1049 $item->setDisabled(
true);
1053 if ($this->
ctrl->getCmd() ===
'addServerSettings') {
1054 $this->form_gui->addCommandButton(
'serverList', $this->
lng->txt(
'cancel'));
1063 $this->tabs_gui->setTabActive(
'settings');
1066 if ($this->form_gui->checkInput()) {
1067 $this->
server->toggleActive((
bool) $this->form_gui->getInput(
'active'));
1068 $this->
server->enableAuthentication(!(
bool) $this->form_gui->getInput(
'ds'));
1069 $this->
server->setName($this->form_gui->getInput(
'server_name'));
1070 $this->
server->setUrl($this->form_gui->getInput(
'server_url'));
1071 $this->
server->setVersion((
int) $this->form_gui->getInput(
'version'));
1072 $this->
server->setBaseDN($this->form_gui->getInput(
'base_dn'));
1073 $this->
server->toggleReferrer((
bool) $this->form_gui->getInput(
'referrals'));
1074 $this->
server->toggleTLS((
bool) $this->form_gui->getInput(
'tls'));
1075 $this->
server->setBindingType((
int) $this->form_gui->getInput(
'binding_type'));
1076 $this->
server->setBindUser($this->form_gui->getInput(
'bind_dn'));
1077 $this->
server->setBindPassword($this->form_gui->getInput(
'bind_pass'));
1078 $this->
server->setSearchBase($this->form_gui->getInput(
'search_base'));
1079 $this->
server->setUserScope((
int) $this->form_gui->getInput(
'user_scope'));
1080 $this->
server->setUserAttribute($this->form_gui->getInput(
'user_attribute'));
1081 $this->
server->setFilter($this->form_gui->getInput(
'filter'));
1082 $this->
server->setGroupDN($this->form_gui->getInput(
'group_dn'));
1083 $this->
server->setGroupScope((
int) $this->form_gui->getInput(
'group_scope'));
1084 $this->
server->setGroupFilter($this->form_gui->getInput(
'group_filter'));
1085 $this->
server->setGroupMember($this->form_gui->getInput(
'group_member'));
1086 $this->
server->enableGroupMemberIsDN((
bool) $this->form_gui->getInput(
'memberisdn'));
1087 $this->
server->setGroupName($this->form_gui->getInput(
'group'));
1088 $this->
server->setGroupAttribute($this->form_gui->getInput(
'group_attribute'));
1089 $this->
server->setGroupUserFilter($this->form_gui->getInput(
'group_user_filter'));
1090 $this->
server->toggleMembershipOptional((
bool) $this->form_gui->getInput(
'group_optional'));
1091 $this->
server->enableSyncOnLogin((
bool) $this->form_gui->getInput(
'sync_on_login'));
1092 $this->
server->enableSyncPerCron((
bool) $this->form_gui->getInput(
'sync_per_cron'));
1093 $this->
server->setGlobalRole((
int) $this->form_gui->getInput(
'global_role'));
1094 $this->
server->enableAccountMigration((
bool) $this->form_gui->getInput(
'migration'));
1095 $this->
server->setUsernameFilter($this->form_gui->getInput(
'name_filter'));
1096 $this->
server->enableEscapeDN((
bool) $this->form_gui->getInput(
'escape_dn'));
1097 if (!$this->
server->validate()) {
1098 $this->main_tpl->setOnScreenMessage(
'failure', $this->ilErr->getMessage());
1099 $url_err = $this->
server->getUrlValidationError();
1100 if (!empty($url_err)) {
1101 $this->form_gui->getItemByPostVar(
'server_url')?->setAlert(
1102 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform($url_err)
1105 $this->form_gui->setValuesByPost();
1106 $this->tpl->setContent($this->form_gui->getHTML());
1110 if ($this->
server->getServerId()) {
1117 $this->mapping->setRule(
'global_role', (
string) $this->form_gui->getInput(
'global_role'),
false);
1118 $this->mapping->save();
1120 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1121 $this->
ctrl->setParameter($this,
'ldap_server_id',
null);
1122 $this->
ctrl->redirect($this,
'serverList');
1125 $this->form_gui->setValuesByPost();
1126 $this->tpl->setContent($this->form_gui->getHTML());
1131 $this->
ctrl->setParameter($this,
'ldap_server_id',
null);
1132 $this->
ctrl->redirect($this,
'serverList');
1137 $this->tabs_gui->clearTargets();
1139 $this->tabs_gui->setBackTarget(
1140 $this->
lng->txt(
'back'),
1141 $this->ctrl->getLinkTarget($this,
'backToServerList')
1144 $this->tabs_gui->addTab(
1146 $this->
lng->txt(
'ldap_settings'),
1147 $this->ctrl->getLinkTarget($this,
'editServerSettings')
1155 $this->tabs_gui->addTab(
1157 $this->
lng->txt(
'ldap_user_mapping'),
1158 $this->ctrl->getLinkTarget($this,
'userMapping')
1161 $this->tabs_gui->addTab(
1163 $this->
lng->txt(
'ldap_role_assignments'),
1164 $this->ctrl->getLinkTarget($this,
'roleAssignments')
1167 $this->tabs_gui->addTab(
1169 $this->
lng->txt(
'ldap_role_mapping'),
1170 $this->ctrl->getLinkTarget($this,
'roleMapping')
1177 if ($this->ldap_server_id) {
1200 $this->rbacReview->getGlobalRoles(),
1206 $select[0] = $this->
lng->txt(
'links_select_one');
1207 foreach ($global_roles as
$role_id) {
1220 'gender' => $this->
lng->txt(
'gender'),
1221 'firstname' => $this->
lng->txt(
'firstname'),
1222 'lastname' => $this->
lng->txt(
'lastname'),
1223 'title' => $this->
lng->txt(
'person_title'),
1224 'institution' => $this->
lng->txt(
'institution'),
1225 'department' => $this->
lng->txt(
'department'),
1226 'street' => $this->
lng->txt(
'street'),
1227 'city' => $this->
lng->txt(
'city'),
1228 'zipcode' => $this->
lng->txt(
'zipcode'),
1229 'country' => $this->
lng->txt(
'country'),
1230 'phone_office' => $this->
lng->txt(
'phone_office'),
1231 'phone_home' => $this->
lng->txt(
'phone_home'),
1232 'phone_mobile' => $this->
lng->txt(
'phone_mobile'),
1233 'fax' => $this->
lng->txt(
'fax'),
1234 'email' => $this->
lng->txt(
'email'),
1235 'second_email' => $this->
lng->txt(
'second_email'),
1236 'hobby' => $this->
lng->txt(
'hobby'),
1237 'matriculation' => $this->
lng->txt(
'matriculation')
1244 $this->
form->setFormAction($this->
ctrl->getFormAction($this));
1247 $role->setInfo($this->
lng->txt(
'ldap_role_name_info'));
1248 $role->setRequired(
true);
1249 $this->
form->addItem($role);
1252 $role->addOption($global);
1256 $global->addSubItem($role_select);
1259 $role->addOption($local);
1262 $role_search->setSize(40);
1263 $local->addSubItem($role_search);
1266 $update->setValue($this->
lng->txt(
'ldap_check_role_assignment'));
1269 $add->setOptionTitle($this->
lng->txt(
'ldap_add_missing'));
1270 $update->addSubItem($add);
1273 $remove->setOptionTitle($this->
lng->txt(
'ldap_remove_deprecated'));
1274 $update->addSubItem($remove);
1276 $this->
form->addItem($update);
1279 $group->setRequired(
true);
1285 $dn->setMaxLength(512);
1286 $dn->setInfo($this->
lng->txt(
'ldap_role_grp_dn_info'));
1287 $radio_group->addSubItem($dn);
1290 $at->setMaxLength(128);
1291 $radio_group->addSubItem($at);
1293 $isdn->setInfo($this->
lng->txt(
'ldap_group_member_info'));
1294 $radio_group->addSubItem($isdn);
1295 $radio_group->setInfo($this->
lng->txt(
'ldap_role_grp_info'));
1297 $group->addOption($radio_group);
1302 $name->setMaxLength(128);
1303 $radio_attribute->addSubItem($name);
1307 $val->setMaxLength(128);
1308 $radio_attribute->addSubItem($val);
1309 $radio_attribute->setInfo($this->
lng->txt(
'ldap_role_at_info'));
1311 $group->addOption($radio_attribute);
1313 $pl_active = $this->component_repository->getPluginSlotById(
'ldaphk')->hasActivePlugins();
1316 $pl->setInfo($this->
lng->txt(
'ldap_plugin_info'));
1317 $pl->setDisabled(!$pl_active);
1320 $id->setDisabled(!$pl_active);
1322 $id->setMaxLength(3);
1323 $id->setMaxValue(999);
1324 $id->setMinValue(1);
1325 $pl->addSubItem(
$id);
1327 $group->addOption($pl);
1328 $this->
form->addItem($group);
1330 if ($this->rbacSystem->checkAccess(
'write', $this->ref_id)) {
1333 $this->
form->setTitle($this->
lng->txt(
'ldap_edit_role_ass_rule'));
1334 $this->
form->addCommandButton(
'updateRoleAssignment', $this->
lng->txt(
'save'));
1337 $this->
form->setTitle($this->
lng->txt(
'ldap_add_role_ass_rule'));
1338 $this->
form->addCommandButton(
'addRoleAssignment', $this->
lng->txt(
'ldap_btn_add_role_ass'));
1342 foreach ($this->
form->getItems() as $item) {
1346 $item->setDisabled(
true);
1359 $select_form->setPostVar(
'mapping_template');
1361 '' => $this->
lng->txt(
'ldap_mapping_template'),
1362 'inetOrgPerson' =>
'inetOrgPerson',
1363 'organizationalPerson' =>
'organizationalPerson',
1364 'person' =>
'person',
1365 'ad_2003' =>
'Active Directory (Win 2003)'
1367 $select_form->setOptions(
$options);
1368 $select_form->setValue($this->mapping_template);
1370 $this->
toolbar->addInputItem($select_form);
1371 $this->
toolbar->addFormButton($this->
lng->txt(
'show'),
'chooseMapping');
1372 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
'chooseMapping'));
1378 $propertie_form->setTitle($this->
lng->txt(
'ldap_mapping_table'));
1379 $propertie_form->setFormAction($this->
ctrl->getFormAction($this,
'saveMapping'));
1383 $text_form->setPostVar(
$mapping .
'_value');
1384 $text_form->setValue($this->mapping->getValue(
$mapping));
1385 $text_form->setSize(32);
1386 $text_form->setMaxLength(255);
1387 $propertie_form->addItem($text_form);
1390 $checkbox_form->setPostVar(
$mapping .
'_update');
1391 $checkbox_form->setChecked($this->mapping->enabledUpdate(
$mapping));
1392 $checkbox_form->setOptionTitle($this->
lng->txt(
'ldap_update_field_info'));
1393 $propertie_form->addItem($checkbox_form);
1396 foreach ($this->
profile->getFields() as $field) {
1397 if (!$field->isCustom()) {
1402 $text_form->setPostVar(
'udf_' . $field->getIdentifier() .
'_value');
1403 $text_form->setValue($this->mapping->getValue(
'udf_' . $field->getIdentifier()));
1404 $text_form->setSize(32);
1405 $text_form->setMaxLength(255);
1406 $propertie_form->addItem($text_form);
1409 $checkbox_form->setPostVar(
'udf_' . $field->getIdentifier() .
'_update');
1410 $checkbox_form->setChecked($this->mapping->enabledUpdate(
'udf_' . $field->getIdentifier()));
1411 $checkbox_form->setOptionTitle($this->
lng->txt(
'ldap_update_field_info'));
1412 $propertie_form->addItem($checkbox_form);
1415 if ($this->rbacSystem->checkAccess(
'write', $this->ref_id)) {
1416 $propertie_form->addCommandButton(
'saveMapping', $this->
lng->txt(
'save'));
1418 foreach ($propertie_form->getItems() as $item) {
1423 $item->setDisabled(
true);
1425 $item->setDisabled(
true);
1429 return $propertie_form;
1437 $this->tabs_gui->setTabActive(
'role_mapping');
1440 $propertie_form->setTitle($this->
lng->txt(
'ldap_role_settings'));
1441 $propertie_form->setFormAction($this->
ctrl->getFormAction($this,
'saveSyncronizationSettings'));
1443 $role_active->setPostVar(
'role_sync_active');
1444 $role_active->setChecked($this->
server->enabledRoleSynchronization());
1445 $propertie_form->addItem($role_active);
1447 $binding->setInfo($this->
lng->txt(
'ldap_role_bind_user_info'));
1449 $user->setPostVar(
'role_bind_user');
1450 $user->setValue($this->
server->getRoleBindDN());
1452 $user->setMaxLength(255);
1453 $binding->addCombinationItem(
'0', $user, $this->
lng->txt(
'ldap_role_bind_user'));
1456 $pass->setPostVar(
'role_bind_pass');
1457 $pass->setValue($this->
server->getRoleBindPassword());
1459 $pass->setMaxLength(100);
1460 $pass->setRetype(
false);
1461 $binding->addCombinationItem(
'1', $pass, $this->
lng->txt(
'ldap_role_bind_pass'));
1463 $propertie_form->addItem($binding);
1465 if ($this->rbacSystem->checkAccess(
'write', $this->ref_id)) {
1467 $this->
lng->txt(
'ldap_new_role_assignment'),
1468 $this->ctrl->getLinkTarget($this,
'addRoleMapping')
1470 $propertie_form->addCommandButton(
'saveSyncronizationSettings', $this->
lng->txt(
'save'));
1472 foreach ($propertie_form->getItems() as $item) {
1476 $item->setDisabled(
true);
1480 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.ldap_role_mappings.html',
'components/ILIAS/LDAP');
1481 $this->tpl->setVariable(
'NEW_ASSIGNMENT_TBL', $propertie_form->getHTML());
1483 $this->tpl->setVariable(
1486 $this->
http->request(),
1489 $this->server->getServerId(),
1490 $this->object_data_cache,
1494 $this->rbacSystem->checkAccess(
'write', $this->ref_id),
1505 $propertie_form->setTitle($this->
lng->txt(
'ldap_edit_role_assignment'));
1506 if ($propertie_form->getItemByPostVar(
'url')) {
1507 $propertie_form->getItemByPostVar(
'url')->setValue(
$mapping->getURL());
1509 if ($propertie_form->getItemByPostVar(
'dn')) {
1510 $propertie_form->getItemByPostVar(
'dn')->setValue(
$mapping->getDN());
1512 if ($propertie_form->getItemByPostVar(
'member')) {
1513 $propertie_form->getItemByPostVar(
'member')->setValue(
$mapping->getMemberAttribute());
1515 if ($propertie_form->getItemByPostVar(
'memberisdn')) {
1516 $propertie_form->getItemByPostVar(
'memberisdn')->setChecked(
$mapping->getMemberISDN());
1518 if ($propertie_form->getItemByPostVar(
'role')) {
1519 $propertie_form->getItemByPostVar(
'role')->setValue(
$mapping->getRoleName());
1521 if ($propertie_form->getItemByPostVar(
'info')) {
1522 $propertie_form->getItemByPostVar(
'info')->setValue(
$mapping->getMappingInfo());
1524 if ($propertie_form->getItemByPostVar(
'info_type')) {
1525 $propertie_form->getItemByPostVar(
'info_type')->setChecked(
$mapping->getMappingInfoType());
1528 $this->tpl->setContent($propertie_form->getHTML());
1536 if ($propertie_form->checkInput() && $this->rbacReview->roleExists($propertie_form->getInput(
'role'))) {
1539 $mapping->setURL($propertie_form->getInput(
'url'));
1540 $mapping->setDN($propertie_form->getInput(
'dn'));
1541 $mapping->setMemberAttribute($propertie_form->getInput(
'member'));
1542 $mapping->setMemberISDN((
bool) $propertie_form->getInput(
'memberisdn'));
1543 $mapping->setRoleByName($propertie_form->getInput(
'role'));
1544 $mapping->setMappingInfo($propertie_form->getInput(
'info'));
1545 $mapping->setMappingInfoType((
bool) $propertie_form->getInput(
'info_type'));
1548 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1549 $this->
ctrl->redirect($this,
'roleMapping');
1551 if (!$this->rbacReview->roleExists($propertie_form->getInput(
'role'))) {
1552 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'ldap_role_not_exists') .
' ' .
1553 $propertie_form->getInput(
'role'));
1555 $propertie_form->setValuesByPost();
1557 $this->tpl->setContent($propertie_form->getHTML());
1565 if (!$this->mappings) {
1566 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
1567 $this->
ctrl->redirect($this,
'roleMapping');
1572 $this->tabs_gui->activateTab(
'role_mapping');
1575 $c_gui->setFormAction($this->
ctrl->getFormAction($this,
'deleteRoleMapping'));
1576 $c_gui->setHeaderText($this->
lng->txt(
'ldap_confirm_del_role_ass'));
1577 $c_gui->setCancel($this->
lng->txt(
'cancel'),
'roleMapping');
1578 $c_gui->setConfirm($this->
lng->txt(
'confirm'),
'deleteRoleMapping');
1580 foreach ($this->mappings as
$id) {
1583 $txt = $this->
lng->txt(
'obj_role') .
': ' . $mapping->getRoleName() .
', ';
1584 $txt .= $this->
lng->txt(
'ldap_group_dn') .
': ' . $mapping->getDN() .
', ';
1585 $txt .= $this->
lng->txt(
'ldap_server_short') .
' ' . $mapping->getURL() .
', ';
1586 $txt .= $this->
lng->txt(
'ldap_group_member_short') .
' ' . $mapping->getMemberAttribute();
1587 $c_gui->addItem(
'mappings[]', (
string)
$id, $txt);
1590 $this->tpl->setContent($c_gui->getHTML());
1597 $this->
ctrl->clearParameters($this);
1601 $this->tpl->setContent($this->form_gui->getHTML());
1609 $this->tabs_gui->setTabActive(
'settings');
1614 $this->tpl->setContent($this->form_gui->getHTML());
1621 if (!$this->ldap_server_id) {
1622 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
1628 $c_gui->setFormAction($this->
ctrl->getFormAction($this,
'deleteServerSettings'));
1629 $c_gui->setHeaderText($this->
lng->txt(
'ldap_confirm_del_server_settings'));
1630 $c_gui->setCancel($this->
lng->txt(
'cancel'),
'serverList');
1631 $c_gui->setConfirm($this->
lng->txt(
'confirm'),
'deleteServerSettings');
1633 $c_gui->addItem(
'server_ids[]', (
string) $setting->getServerId(), $setting->getName());
1635 $this->tpl->setContent($c_gui->getHTML());
1642 if (!$this->server_ids) {
1643 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
1648 foreach ($this->server_ids as $server_id) {
1653 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'deleted'),
true);
1654 $this->
ctrl->redirect($this,
'serverlist');
1662 $this->tabs_gui->activateTab(
'user_mapping');
1667 $this->tpl->setContent($propertie_form->getHTML());
1674 $this->
server->toggleActive(
true);
1677 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(
'saved_successfully'),
true);
1678 $this->
ctrl->setParameter($this,
'ldap_server_id',
null);
1679 $this->
ctrl->redirect($this,
'serverList');
1686 $this->
server->toggleActive(
false);
1689 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->
lng->txt(
'saved_successfully'),
true);
1690 $this->
ctrl->setParameter($this,
'ldap_server_id',
null);
1691 $this->
ctrl->redirect($this,
'serverList');
1697 $this->tabs_gui->activateTab(
'role_mapping');
1699 if ($this->mapping_id) {
1700 $this->
ctrl->setParameter($this,
'mapping_id', $this->mapping_id);
1704 $propertie_form->setTitle($this->
lng->txt(
'ldap_mapping_table'));
1705 $propertie_form->setFormAction($this->
ctrl->getFormAction($this, $command));
1708 $url->setPostVar(
'url');
1710 $url->setMaxLength(255);
1711 $url->setRequired(
true);
1714 $group_dn->setPostVar(
'dn');
1715 $group_dn->setSize(50);
1716 $group_dn->setMaxLength(255);
1717 $group_dn->setInfo($this->
lng->txt(
'ldap_dn_info'));
1718 $group_dn->setRequired(
true);
1721 $member->setPostVar(
'member');
1722 $member->setSize(32);
1723 $member->setMaxLength(255);
1724 $member->setInfo($this->
lng->txt(
'ldap_member_info'));
1725 $member->setRequired(
true);
1728 $member_isdn->setPostVar(
'memberisdn');
1729 $member_isdn->setOptionTitle($this->
lng->txt(
'ldap_memberisdn'));
1732 $role->setPostVar(
'role');
1734 $role->setMaxLength(255);
1735 $role->setInfo($this->
lng->txt(
'ldap_role_info'));
1736 $role->setRequired(
true);
1739 $info->setPostVar(
'info');
1742 $info->setInfo($this->
lng->txt(
'ldap_info_text_info'));
1745 $info_type->setPostVar(
'info_type');
1746 $info_type->setOptionTitle($this->
lng->txt(
'ldap_mapping_info_type'));
1748 $propertie_form->addItem(
$url);
1749 $propertie_form->addItem($group_dn);
1750 $propertie_form->addItem($member);
1751 $propertie_form->addItem($member_isdn);
1752 $propertie_form->addItem($role);
1753 $propertie_form->addItem(
$info);
1754 $propertie_form->addItem($info_type);
1756 if ($this->rbacSystem->checkAccess(
'write', $this->ref_id)) {
1757 $propertie_form->addCommandButton($command, $this->
lng->txt(
'save'));
1759 foreach ($propertie_form->getItems() as $item) {
1764 $item->setDisabled(
true);
1767 $propertie_form->addCommandButton(
'roleMapping', $this->
lng->txt(
'cancel'));
1769 return $propertie_form;
1775 if ($propertie_form->getItemByPostVar(
'url')) {
1776 $propertie_form->getItemByPostVar(
'url')->setValue($this->
server->getUrl());
1779 if ($this->mapping_id) {
1782 if ($propertie_form->getItemByPostVar(
'url')) {
1783 $propertie_form->getItemByPostVar(
'url')->setValue(
$mapping->getURL());
1785 if ($propertie_form->getItemByPostVar(
'dn')) {
1786 $propertie_form->getItemByPostVar(
'dn')->setValue(
$mapping->getDN());
1788 if ($propertie_form->getItemByPostVar(
'member')) {
1789 $propertie_form->getItemByPostVar(
'member')->setValue(
$mapping->getMemberAttribute());
1791 if ($propertie_form->getItemByPostVar(
'memberisdn')) {
1792 $propertie_form->getItemByPostVar(
'memberisdn')->setChecked(
$mapping->getMemberISDN());
1794 if ($propertie_form->getItemByPostVar(
'role')) {
1795 $propertie_form->getItemByPostVar(
'role')->setValue(
$mapping->getRoleName());
1797 if ($propertie_form->getItemByPostVar(
'info')) {
1798 $propertie_form->getItemByPostVar(
'info')->setValue(
$mapping->getMappingInfo());
1800 if ($propertie_form->getItemByPostVar(
'info_type')) {
1801 $propertie_form->getItemByPostVar(
'info_type')->setChecked(
$mapping->getMappingInfoType());
1805 $this->tpl->setContent($propertie_form->getHTML());
1813 if ($propertie_form->checkInput() &&
1814 $this->rbacReview->roleExists($propertie_form->getInput(
'role'))) {
1817 $mapping->setURL($propertie_form->getInput(
'url'));
1818 $mapping->setDN($propertie_form->getInput(
'dn'));
1819 $mapping->setMemberAttribute($propertie_form->getInput(
'member'));
1820 $mapping->setMemberISDN((
bool) $propertie_form->getInput(
'memberisdn'));
1821 $mapping->setRoleByName($propertie_form->getInput(
'role'));
1822 $mapping->setMappingInfo($propertie_form->getInput(
'info'));
1823 $mapping->setMappingInfoType((
bool) $propertie_form->getInput(
'info_type'));
1826 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1827 $this->
ctrl->redirect($this,
'roleMapping');
1829 if (!$this->rbacReview->roleExists($propertie_form->getInput(
'role'))) {
1830 $this->main_tpl->setOnScreenMessage(
1832 $this->
lng->txt(
'ldap_role_not_exists') .
' ' . $propertie_form->getInput(
'role')
1835 $propertie_form->setValuesByPost();
1837 $this->tpl->setContent($propertie_form->getHTML());
1845 $this->
server->setRoleBindDN($this->role_bind_user);
1846 $this->
server->setRoleBindPassword($this->role_bind_pass);
1847 $this->
server->enableRoleSynchronization($this->role_sync_active);
1849 if ($this->
server->getServerId()) {
1853 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1854 $this->
ctrl->redirect($this,
'roleMapping');
1860 'handleServerTableActions',
1861 'handleRoleAssignmentTableActions',
1862 'handleRoleMappingTableActions',
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class ilAccessHandler Checks access for ILIAS objects.
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
Error Handling & global info handling.
static _getMappingRulesByClass(string $a_class)
Get mapping rule by objectClass.
This class stores the settings that define the mapping between LDAP attribute and user profile fields...
static _lookupGlobalRole(int $a_server_id)
static _getInstanceByServerId(int $a_server_id)
save()
Save mapping rules to db.
read()
Read mapping settings from db.
static _getRules($a_server_id)
Get all rules.
static _getInstanceByRuleId(int $a_rule_id)
static _getInstanceByServerId(int $a_server_id)
Get instance of class.
static _getServerList()
Get list of all configured servers.
const LDAP_BIND_ANONYMOUS
static checkLDAPLib()
Check if ldap module is installed.
static _getAllServer()
Get list of all configured servers.
checkAccess(string $permission)
array $attribute_mappings
handleServerTableActionsCmd()
addRoleAutoCompleteObjectCmd()
saveSyncronizationSettingsCmd()
ilLDAPRoleAssignmentRule $role_mapping_rule
readonly ILIAS HTTP GlobalHttpState $http
loadRoleAssignmentRule(int $a_rule_id, bool $load_from_form=true)
getUnsafeGetCommands()
This method must return a list of unsafe GET commands.
readonly ILIAS UI Factory $ui_factory
ilComponentRepository $component_repository
initRoleMappingForm(string $command)
getAttributeMappingKeys()
confirmDeleteRoleMapping()
updateRoleAssignmentCmd()
ilLDAPRoleGroupMappingSettings $role_mapping
checkRoleAssignmentInput(int $a_rule_id=0)
deleteServerSettingsCmd()
handleRoleMappingTableActionsCmd()
readonly ILIAS Refinery Factory $refinery
confirmDeleteServerSettings()
ilPropertyFormGUI $form_gui
getRoleAssigmentsTableAction()
readonly ILIAS UI Renderer $ui_renderer
handleRoleAssignmentTableActionsCmd()
getRoleMappingsTableAction()
__construct(int $a_auth_ref_id)
prepareGlobalRoleSelection()
readonly ilObjectDataCache $object_data_cache
ilAccessHandler $ilAccess
initFormRoleAssignments(string $a_mode)
ilGlobalTemplateInterface $tpl
getSafePostCommands()
This method must return a list of safe POST commands.
ilLDAPAttributeMapping $mapping
ilGlobalTemplateInterface $main_tpl
ilLDAPRoleAssignmentRule $rule
readonly Profile $profile
This class represents a non editable value in a property form.
static _lookupTitle(int $obj_id)
This class represents an option in a radio group.
class ilRbacReview Contains Review functions of core Rbac.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static _sortIds(array $a_ids, string $a_table, string $a_field, string $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,...
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
Readable part of repository interface to ilComponentDataDB.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
form(?array $class_path, string $cmd, string $submit_caption="")