ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLDAPSettingsGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
34{
35 private $ref_id = null;
36 private $server = null;
37
38 public function __construct($a_auth_ref_id)
39 {
40 global $lng,$ilCtrl,$tpl,$ilTabs;
41
42 $this->ctrl = $ilCtrl;
43 $this->tabs_gui = $ilTabs;
44 $this->lng = $lng;
45 $this->lng->loadLanguageModule('ldap');
46
47 $this->tpl = $tpl;
48
49 if ($_GET["cmd"] != "addServerSettings") {
50 $this->ctrl->saveParameter($this, 'ldap_server_id');
51 }
52
53
54 $this->ref_id = $a_auth_ref_id;
55
56
57 $this->initServer();
58 }
59
60 public function executeCommand()
61 {
62 global $ilAccess,$ilias, $ilErr, $ilCtrl;
63
64 $next_class = $this->ctrl->getNextClass($this);
65 $cmd = $this->ctrl->getCmd();
66
67 if (!$ilAccess->checkAccess('write', '', $this->ref_id) && $cmd != "serverList") {
68 ilUtil::sendFailure($this->lng->txt('msg_no_perm_write'), true);
69 $ilCtrl->redirect($this, "serverList");
70 }
71
72
73 switch ($next_class) {
74 default:
75 if (!$cmd) {
76 $cmd = "serverList";
77 }
78 $this->$cmd();
79 break;
80 }
81 return true;
82 }
83
88 public function getServer()
89 {
90 return $this->server;
91 }
92
99 public function roleAssignments()
100 {
101 global $rbacreview;
102
103 $this->setSubTabs();
104 $this->tabs_gui->setTabActive('role_assignments');
105
106 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_assignments.html', 'Services/LDAP');
107
108 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
109 $this->initFormRoleAssignments('create', $this->role_mapping_rule = ilLDAPRoleAssignmentRule::_getInstanceByRuleId(0));
110 $this->tpl->setVariable('NEW_ASSIGNMENT_TBL', $this->form->getHTML());
111
112
113 if (count($rules = ilLDAPRoleAssignmentRule::_getRules($this->server->getServerId()))) {
114 include_once("./Services/LDAP/classes/class.ilLDAPRoleAssignmentTableGUI.php");
115 $table_gui = new ilLDAPRoleAssignmentTableGUI($this, 'roleAssignments');
116 $table_gui->setTitle($this->lng->txt("ldap_tbl_role_ass"));
117 $table_gui->parse($rules);
118 $table_gui->addMultiCommand("confirmDeleteRules", $this->lng->txt("delete"));
119 $table_gui->setSelectAllCheckbox("rule_id");
120 $this->tpl->setVariable('RULES_TBL', $table_gui->getHTML());
121 }
122 }
123
130 public function editRoleAssignment()
131 {
132 if (!(int) $_GET['rule_id']) {
133 ilUtil::sendFailure($this->lng->txt('select_one'));
134 $this->roleAssignments();
135 return false;
136 }
137 $this->setSubTabs();
138 $this->tabs_gui->setTabActive('role_assignments');
139
140 $this->ctrl->saveParameter($this, 'rule_id', (int) $_GET['rule_id']);
141 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
143 'edit',
144 $this->role_mapping_rule = ilLDAPRoleAssignmentRule::_getInstanceByRuleId((int) $_GET['rule_id'])
145 );
146 $this->setValuesByArray();
147 $this->tpl->setContent($this->form->getHTML());
148 }
149
150
155 protected function setValuesByArray()
156 {
157 global $rbacreview;
158
159 $role_id = $this->role_mapping_rule->getRoleId();
160 if ($rbacreview->isGlobalRole($role_id)) {
161 $val['role_name'] = 0;
162 $val['role_id'] = $role_id;
163 } else {
164 $val['role_name'] = 1;
165 $val['role_search'] = ilObject::_lookupTitle($role_id);
166 }
167 $val['add_missing'] = (int) $this->role_mapping_rule->isAddOnUpdateEnabled();
168 $val['remove_deprecated'] = (int) $this->role_mapping_rule->isRemoveOnUpdateEnabled();
169 $val['type'] = (int) $this->role_mapping_rule->getType();
170 $val['dn'] = $this->role_mapping_rule->getDN();
171 $val['at'] = $this->role_mapping_rule->getMemberAttribute();
172 $val['isdn'] = $this->role_mapping_rule->isMemberAttributeDN();
173 $val['name'] = $this->role_mapping_rule->getAttributeName();
174 $val['value'] = $this->role_mapping_rule->getAttributeValue();
175 $val['plugin_id'] = $this->role_mapping_rule->getPluginId();
176
177 $this->form->setValuesByArray($val);
178 }
179
186 public function updateRoleAssignment()
187 {
188 global $ilErr,$ilAccess;
189
190 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
191 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
192 $this->roleAssignment();
193 return false;
194 }
195
196 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
197 include_once('Services/LDAP/classes/class.ilLDAPServer.php');
198
199 $this->initFormRoleAssignments('edit');
200 if (!$this->form->checkInput() or ($err = $this->checkRoleAssignmentInput((int) $_REQUEST['rule_id']))) {
201 if ($err) {
202 ilUtil::sendFailure($this->lng->txt($err));
203 }
204
205 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_assignments.html', 'Services/LDAP');
206
207 // DONE: wrap this
208 $this->form->setValuesByPost();
209 $this->tpl->setVariable('NEW_ASSIGNMENT_TBL', $this->form->getHTML());
210 #$this->tpl->setVariable('RULES_TBL',$this->getRoleAssignmentTable());
211 $this->tabs_gui->setSubTabActive('shib_role_assignment');
212 return true;
213 }
214
215 // Might redirect
216 $this->roleSelection();
217
218 $this->rule->update();
219 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
220 $this->roleAssignments();
221 return true;
222 }
223
231 public function confirmDeleteRules()
232 {
233 if (!is_array($_POST['rule_ids'])) {
234 ilUtil::sendFailure($this->lng->txt('select_one'));
235 $this->roleAssignments();
236 return false;
237 }
238 $this->setSubTabs();
239 $this->tabs_gui->setTabActive('role_assignments');
240
241 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
242 $c_gui = new ilConfirmationGUI();
243
244 // set confirm/cancel commands
245 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteRules"));
246 $c_gui->setHeaderText($this->lng->txt("ldap_confirm_del_role_ass"));
247 $c_gui->setCancel($this->lng->txt("cancel"), "roleAssignments");
248 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteRules");
249
250 // add items to delete
251 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
252 foreach ($_POST["rule_ids"] as $rule_id) {
254 $c_gui->addItem('rule_ids[]', $rule_id, $rule->conditionToString());
255 }
256 $this->tpl->setContent($c_gui->getHTML());
257 }
258
265 public function deleteRules()
266 {
267 if (!is_array($_POST['rule_ids'])) {
268 ilUtil::sendFailure($this->lng->txt('select_once'));
269 $this->roleAssignments();
270 return false;
271 }
272 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
273 foreach ($_POST["rule_ids"] as $rule_id) {
275 $rule->delete();
276 }
277 ilUtil::sendSuccess($this->lng->txt('ldap_deleted_rule'));
278 $this->roleAssignments();
279 return true;
280 }
281
288 public function addRoleAssignment()
289 {
290 global $ilErr,$ilAccess;
291
292 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
293 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
294 $this->roleAssignment();
295 return false;
296 }
297
298 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
299 include_once('Services/LDAP/classes/class.ilLDAPServer.php');
300
301 $this->initFormRoleAssignments('create');
302 if (!$this->form->checkInput() or ($err = $this->checkRoleAssignmentInput())) {
303 if ($err) {
304 ilUtil::sendFailure($this->lng->txt($err));
305 }
306
307 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_assignments.html', 'Services/LDAP');
308
309 // DONE: wrap this
310 $this->form->setValuesByPost();
311 $this->tpl->setVariable('NEW_ASSIGNMENT_TBL', $this->form->getHTML());
312 $this->tpl->setVariable('RULES_TBL', $this->getRoleAssignmentTable());
313 $this->tabs_gui->setSubTabActive('shib_role_assignment');
314 return true;
315 }
316
317 // Might redirect
318 $this->roleSelection();
319
320 $this->rule->create();
321 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
322 unset($_POST);
323 $this->roleAssignments();
324 return true;
325 }
326
331 protected function roleSelection()
332 {
333 if ($this->rule->getRoleId() > 0) {
334 return false;
335 }
336 $_SESSION['ldap_role_ass']['server_id'] = $this->getServer()->getServerId();
337 $_SESSION['ldap_role_ass']['rule_id'] = $_REQUEST['rule_id'] ? $_REQUEST['rule_id'] : 0;
338 $_SESSION['ldap_role_ass']['role_search'] = $this->form->getInput('role_search');
339 $_SESSION['ldap_role_ass']['add_on_update'] = $this->form->getInput('add_missing');
340 $_SESSION['ldap_role_ass']['remove_on_update'] = $this->form->getInput('remove_deprecated');
341 $_SESSION['ldap_role_ass']['type'] = $this->form->getInput('type');
342 $_SESSION['ldap_role_ass']['dn'] = $this->form->getInput('dn');
343 $_SESSION['ldap_role_ass']['at'] = $this->form->getInput('at');
344 $_SESSION['ldap_role_ass']['isdn'] = $this->form->getInput('isdn');
345 $_SESSION['ldap_role_ass']['name'] = $this->form->getInput('name');
346 $_SESSION['ldap_role_ass']['value'] = $this->form->getInput('value');
347 $_SESSION['ldap_role_ass']['plugin'] = $this->form->getInput('plugin_id');
348
349
350 $this->ctrl->saveParameter($this, 'rule_id');
351 $this->ctrl->redirect($this, 'showRoleSelection');
352 }
353
354
355
360 protected function showRoleSelection()
361 {
362 $this->setSubTabs();
363 $this->tabs_gui->setTabActive('role_assignment');
364 $this->ctrl->saveParameter($this, 'rule_id');
365
366 include_once './Services/Search/classes/class.ilQueryParser.php';
367 $parser = new ilQueryParser($_SESSION['ldap_role_ass']['role_search']);
368 $parser->setMinWordLength(1, true);
369 $parser->setCombination(QP_COMBINATION_AND);
370 $parser->parse();
371
372 include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
373 $object_search = new ilLikeObjectSearch($parser);
374 $object_search->setFilter(array('role'));
375 $res = $object_search->performSearch();
376
377 $entries = $res->getEntries();
378
379 include_once './Services/AccessControl/classes/class.ilRoleSelectionTableGUI.php';
380 $table = new ilRoleSelectionTableGUI($this, 'showRoleSelection');
381 $table->setTitle($this->lng->txt('ldap_role_selection'));
382 $table->addMultiCommand('saveRoleSelection', $this->lng->txt('ldap_choose_role'));
383 #$table->addCommandButton('roleAssignment',$this->lng->txt('cancel'));
384 $table->parse($entries);
385
386 $this->tpl->setContent($table->getHTML());
387 return true;
388 }
389
394 protected function saveRoleSelection()
395 {
396 global $ilErr,$ilAccess;
397
398 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
399 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
400 $this->roleAssignment();
401 return false;
402 }
403
404 if (!(int) $_REQUEST['role_id']) {
405 ilUtil::sendFailure($this->lng->txt('select_one'));
406 $this->showRoleSelection();
407 return false;
408 }
409
410 $this->loadRoleAssignmentRule((int) $_REQUEST['rule_id'], false);
411 $this->rule->setRoleId((int) $_REQUEST['role_id']);
412
413 if ((int) $_REQUEST['rule_id']) {
414 $this->rule->update();
415 } else {
416 $this->rule->create();
417 }
418
419 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
420 $this->roleAssignments();
421 return true;
422 }
423
424
430 protected function checkRoleAssignmentInput($a_rule_id = 0)
431 {
432 global $ilErr;
433
434 $this->loadRoleAssignmentRule($a_rule_id);
435 $this->rule->validate();
436 return $ilErr->getMessage();
437 }
438
439
444 protected function getRoleAssignmentTable()
445 {
446 if (count($rules = ilLDAPRoleAssignmentRule::_getRules($this->server->getServerId()))) {
447 include_once("./Services/LDAP/classes/class.ilLDAPRoleAssignmentTableGUI.php");
448 $table_gui = new ilLDAPRoleAssignmentTableGUI($this, 'roleAssignments');
449 $table_gui->setTitle($this->lng->txt("ldap_tbl_role_ass"));
450 $table_gui->parse($rules);
451 $table_gui->addMultiCommand("confirmDeleteRules", $this->lng->txt("delete"));
452 $table_gui->setSelectAllCheckbox("rule_id");
453 return $table_gui->getHTML();
454 }
455 return '';
456 }
457
458
464 protected function loadRoleAssignmentRule($a_rule_id, $a_from_form = true)
465 {
466 if (is_object($this->rule)) {
467 return true;
468 }
469
470 include_once './Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
471 $this->rule = ilLDAPRoleAssignmentRule::_getInstanceByRuleId($a_rule_id);
472
473
474 if ($a_from_form) {
475 if ($this->form->getInput('role_name') == 0) {
476 $this->rule->setRoleId($this->form->getInput('role_id'));
477 } elseif ($this->form->getInput('role_search')) {
478 // Search role
479 include_once './Services/Search/classes/class.ilQueryParser.php';
480
481 $parser = new ilQueryParser('"' . $this->form->getInput('role_search') . '"');
482
483 // TODO: Handle minWordLength
484 $parser->setMinWordLength(1, true);
485 $parser->setCombination(QP_COMBINATION_AND);
486 $parser->parse();
487
488 include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
489 $object_search = new ilLikeObjectSearch($parser);
490 $object_search->setFilter(array('role'));
491 $res = $object_search->performSearch();
492
493 $entries = $res->getEntries();
494 if (count($entries) == 1) {
495 $role = current($entries);
496 $this->rule->setRoleId($role['obj_id']);
497 } elseif (count($entries) > 1) {
498 $this->rule->setRoleId(-1);
499 }
500 }
501
502 $this->rule->setAttributeName($this->form->getInput('name'));
503 $this->rule->setAttributeValue($this->form->getInput('value'));
504 $this->rule->setDN($this->form->getInput('dn'));
505 $this->rule->setMemberAttribute($this->form->getInput('at'));
506 $this->rule->setMemberIsDN($this->form->getInput('isdn'));
507 $this->rule->enableAddOnUpdate($this->form->getInput('add_missing'));
508 $this->rule->enableRemoveOnUpdate($this->form->getInput('remove_deprecated'));
509 $this->rule->setPluginId($this->form->getInput('plugin_id'));
510 $this->rule->setType($this->form->getInput('type'));
511 $this->rule->setServerId($this->getServer()->getServerId());
512 return true;
513 }
514
515 // LOAD from session
516 $this->rule = ilLDAPRoleAssignmentRule::_getInstanceByRuleId($a_rule_id);
517 $this->rule->setServerId($this->getServer()->getServerId());
518 $this->rule->enableAddOnUpdate((int) $_SESSION['ldap_role_ass']['add_on_update']);
519 $this->rule->enableRemoveOnUpdate((int) $_SESSION['ldap_role_ass']['remove_on_update']);
520 $this->rule->setType(ilUtil::stripSlashes($_SESSION['ldap_role_ass']['type']));
521 $this->rule->setDN(ilUtil::stripSlashes($_SESSION['ldap_role_ass']['dn']));
522 $this->rule->setMemberAttribute(ilUtil::stripSlashes($_SESSION['ldap_role_ass']['at']));
523 $this->rule->setMemberIsDN(ilUtil::stripSlashes($_SESSION['ldap_role_ass']['isdn']));
524 $this->rule->setAttributeName(ilUtil::stripSlashes($_SESSION['ldap_role_ass']['name']));
525 $this->rule->setAttributeValue(ilUtil::stripSlashes($_SESSION['ldap_role_ass']['value']));
526 $this->rule->setPluginId(ilUtil::stripSlashes($_SESSION['ldap_role_ass']['plugin']));
527 return true;
528 }
529
530 public function deleteRoleMapping()
531 {
532 if (!count($_POST['mappings'])) {
533 ilUtil::sendFailure($this->lng->txt('select_one'));
534 $this->roleMapping();
535 return false;
536 }
537
538 $this->initRoleMapping();
539
540 foreach ($_POST['mappings'] as $mapping_id) {
541 $this->role_mapping->delete($mapping_id);
542 }
543 ilUtil::sendSuccess($this->lng->txt('ldap_deleted_role_mapping'));
544 $this->roleMapping();
545 return true;
546 }
547
548 public function chooseMapping()
549 {
550 if (!$_POST['mapping_template']) {
551 $this->userMapping();
552 return;
553 }
554
555 $this->initAttributeMapping();
556 $this->mapping->clearRules();
557
558 include_once('Services/LDAP/classes/class.ilLDAPAttributeMappingUtils.php');
559 foreach (ilLDAPAttributeMappingUtils::_getMappingRulesByClass($_POST['mapping_template']) as $key => $value) {
560 $this->mapping->setRule($key, $value, 0);
561 }
562 $this->userMapping();
563 return true;
564 }
565
566 public function saveMapping()
567 {
568 $this->initAttributeMapping();
569 $this->tabs_gui->setTabActive('role_mapping');
570
571 foreach ($this->getMappingFields() as $key => $mapping) {
572 $this->mapping->setRule($key, ilUtil::stripSlashes($_POST[$key . '_value']), (int) $_POST[$key . '_update']);
573 }
574 $this->initUserDefinedFields();
575 foreach ($this->udf->getDefinitions() as $definition) {
576 $key = 'udf_' . $definition['field_id'];
577 $this->mapping->setRule($key, ilUtil::stripSlashes($_POST[$key . '_value']), (int) $_POST[$key . '_update']);
578 }
579
580 $this->mapping->save();
581 $this->userMapping();
582
583 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
584 unset($_POST['mapping_template']);
585 return;
586 }
587
588 public function serverList()
589 {
590 global $ilAccess, $ilErr, $ilToolbar;
591
592 if (!$ilAccess->checkAccess('read', '', $this->ref_id) && $cmd != "serverList") {
593 $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
594 }
595
596 if (!ilLDAPServer::checkLDAPLib() and $this->server->isActive()) {
597 ilUtil::sendFailure('Missing LDAP libraries. Please ensure that the PHP LDAP module is installed on your server.');
598 }
599
600 $ilToolbar->addButton(
601 $this->lng->txt("add_ldap_server"),
602 $this->ctrl->getLinkTarget($this, "addServerSettings")
603 );
604
605 include_once './Services/LDAP/classes/class.ilLDAPServerTableGUI.php';
606
607 $table = new ilLDAPServerTableGUI($this, "serverList");
608
609
610 return $this->tpl->setContent($table->getHTML());
611 }
612
613 public function setServerFormValues()
614 {
615 $this->form_gui->setValuesByArray(array(
616 'active' => $this->server->isActive(),
617 'ds' => !$this->server->isAuthenticationEnabled(),
618 'server_name' => $this->server->getName(),
619 'server_url' => $this->server->getUrlString(),
620 'version' => $this->server->getVersion(),
621 'base_dn' => $this->server->getBaseDN(),
622 'referrals' => $this->server->isActiveReferrer(),
623 'tls' => $this->server->isActiveTLS(),
624 'binding_type' => $this->server->getBindingType(),
625 'bind_dn' => $this->server->getBindUser(),
626 'bind_pass' => $this->server->getBindPassword(),
627 'bind_pass_retype' => $this->server->getBindPassword(),
628 'search_base' => $this->server->getSearchBase(),
629 'user_scope' => $this->server->getUserScope(),
630 'user_attribute' => $this->server->getUserAttribute(),
631 'filter' => $this->server->getFilter(),
632 'group_dn' => $this->server->getGroupDN(),
633 'group_scope' => $this->server->getGroupScope(),
634 'group_filter' => $this->server->getGroupFilter(),
635 'group_member' => $this->server->getGroupMember(),
636 'memberisdn' => $this->server->enabledGroupMemberIsDN(),
637 'group' => $this->server->getGroupName(),
638 'group_attribute' => $this->server->getGroupAttribute(),
639 'group_optional' => $this->server->isMembershipOptional(),
640 'group_user_filter' => $this->server->getGroupUserFilter(),
641 'sync_on_login' => $this->server->enabledSyncOnLogin(),
642 'sync_per_cron' => $this->server->enabledSyncPerCron(),
643 'global_role' => ilLDAPAttributeMapping::_lookupGlobalRole($this->server->getServerId()),
644 'migration' => (int) $this->server->isAccountMigrationEnabled(),
645 // start Patch Name Filter
646 "name_filter" => $this->server->getUsernameFilter()
647 // end Patch Name Filter
648 ));
649 }
650
651 private function initForm()
652 {
653 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
654
655 $this->form_gui = new ilPropertyFormGUI();
656 $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
657 $this->form_gui->setTitle($this->lng->txt('ldap_configure'));
658
659 $active = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_enable'), 'active');
660 $active->setValue(1);
661 $this->form_gui->addItem($active);
662
663 $ds = new ilCheckboxInputGUI($this->lng->txt('ldap_as_ds'), 'ds');
664 $ds->setValue(1);
665 $ds->setInfo($this->lng->txt('ldap_as_ds_info'));
666 $this->form_gui->addItem($ds);
667
668 $servername = new ilTextInputGUI($this->lng->txt('ldap_server_name'), 'server_name');
669 $servername->setRequired(true);
670 $servername->setInfo($this->lng->txt('ldap_server_name_info'));
671 $servername->setSize(32);
672 $servername->setMaxLength(32);
673 $this->form_gui->addItem($servername);
674
675 // start Patch Name Filter
676 $namefilter = new ilTextInputGUI($this->lng->txt('ldap_username_filter'), "name_filter");//ADD LANG VAR
677 $namefilter->setInfo($this->lng->txt("ldap_username_filter_info"));
678 $namefilter->setSize(64);
679 $namefilter->setMaxLength(255);
680 $this->form_gui->addItem($namefilter);
681 // end Patch Name Filter
682
683 $serverurl = new ilTextInputGUI($this->lng->txt('ldap_server'), 'server_url');
684 $serverurl->setRequired(true);
685 $serverurl->setInfo($this->lng->txt('ldap_server_url_info'));
686 $serverurl->setSize(64);
687 $serverurl->setMaxLength(255);
688 $this->form_gui->addItem($serverurl);
689
690 $version = new ilSelectInputGUI($this->lng->txt('ldap_version'), 'version');
691 $version->setOptions(array(2 => 2, 3 => 3));
692 $version->setInfo($this->lng->txt('ldap_server_version_info'));
693 $this->form_gui->addItem($version);
694
695 $basedsn = new ilTextInputGUI($this->lng->txt('basedn'), 'base_dn');
696 $basedsn->setRequired(true);
697 $basedsn->setSize(64);
698 $basedsn->setMaxLength(255);
699 $this->form_gui->addItem($basedsn);
700
701 $referrals = new ilCheckboxInputGUI($this->lng->txt('ldap_referrals'), 'referrals');
702 $referrals->setValue(1);
703 $referrals->setInfo($this->lng->txt('ldap_referrals_info'));
704 $this->form_gui->addItem($referrals);
705
706 $section_security = new ilFormSectionHeaderGUI();
707 $section_security->setTitle($this->lng->txt('ldap_server_security_settings'));
708 $this->form_gui->addItem($section_security);
709
710 $tls = new ilCheckboxInputGUI($this->lng->txt('ldap_tls'), 'tls');
711 $tls->setValue(1);
712 $this->form_gui->addItem($tls);
713
714 $binding = new ilRadioGroupInputGUI($this->lng->txt('ldap_server_binding'), 'binding_type');
715 $anonymous = new ilRadioOption($this->lng->txt('ldap_bind_anonymous'), IL_LDAP_BIND_ANONYMOUS);
716 $binding->addOption($anonymous);
717 $user = new ilRadioOption($this->lng->txt('ldap_bind_user'), IL_LDAP_BIND_USER);
718 $dn = new ilTextInputGUI($this->lng->txt('ldap_server_bind_dn'), 'bind_dn');
719 $dn->setSize(64);
720 $dn->setMaxLength(255);
721 $user->addSubItem($dn);
722 $pass = new ilPasswordInputGUI($this->lng->txt('ldap_server_bind_pass'), 'bind_pass');
723 $pass->setSkipSyntaxCheck(true);
724 $pass->setSize(12);
725 $pass->setMaxLength(36);
726 $user->addSubItem($pass);
727 $binding->addOption($user);
728 $this->form_gui->addItem($binding);
729
730 $section_auth = new ilFormSectionHeaderGUI();
731 $section_auth->setTitle($this->lng->txt('ldap_authentication_settings'));
732 $this->form_gui->addItem($section_auth);
733
734 $search_base = new ilTextInputGUI($this->lng->txt('ldap_user_dn'), 'search_base');
735 $search_base->setInfo($this->lng->txt('ldap_search_base_info'));
736 $search_base->setSize(64);
737 $search_base->setMaxLength(255);
738 $this->form_gui->addItem($search_base);
739
740 $user_scope = new ilSelectInputGUI($this->lng->txt('ldap_user_scope'), 'user_scope');
741 $user_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'),
742 IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
743 $user_scope->setInfo($this->lng->txt('ldap_user_scope_info'));
744 $this->form_gui->addItem($user_scope);
745
746 $user_attribute = new ilTextInputGUI($this->lng->txt('ldap_user_attribute'), 'user_attribute');
747 $user_attribute->setSize(16);
748 $user_attribute->setMaxLength(64);
749 $user_attribute->setRequired(true);
750 $this->form_gui->addItem($user_attribute);
751
752 $filter = new ilTextInputGUI($this->lng->txt('ldap_search_filter'), 'filter');
753 $filter->setInfo($this->lng->txt('ldap_filter_info'));
754 $filter->setSize(64);
755 $filter->setMaxLength(512);
756 $this->form_gui->addItem($filter);
757
758 $section_restrictions = new ilFormSectionHeaderGUI();
759 $section_restrictions->setTitle($this->lng->txt('ldap_group_restrictions'));
760 $this->form_gui->addItem($section_restrictions);
761
762 $group_dn = new ilTextInputGUI($this->lng->txt('ldap_group_search_base'), 'group_dn');
763 $group_dn->setInfo($this->lng->txt('ldap_group_dn_info'));
764 $group_dn->setSize(64);
765 $group_dn->setMaxLength(255);
766 $this->form_gui->addItem($group_dn);
767
768 $group_scope = new ilSelectInputGUI($this->lng->txt('ldap_group_scope'), 'group_scope');
769 $group_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'),
770 IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
771 $group_scope->setInfo($this->lng->txt('ldap_group_scope_info'));
772 $this->form_gui->addItem($group_scope);
773
774 $group_filter = new ilTextInputGUI($this->lng->txt('ldap_group_filter'), 'group_filter');
775 $group_filter->setInfo($this->lng->txt('ldap_group_filter_info'));
776 $group_filter->setSize(64);
777 $group_filter->setMaxLength(255);
778 $this->form_gui->addItem($group_filter);
779
780 $group_member = new ilTextInputGUI($this->lng->txt('ldap_group_member'), 'group_member');
781 $group_member->setInfo($this->lng->txt('ldap_group_member_info'));
782 $group_member->setSize(32);
783 $group_member->setMaxLength(255);
784 $this->form_gui->addItem($group_member);
785
786
787 $group_member_isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_memberisdn'), 'memberisdn');
788 #$group_member_isdn->setInfo($this->lng->txt('ldap_group_member_info'));
789 $this->form_gui->addItem($group_member_isdn);
790 #$group_member->addSubItem($group_member_isdn);
791
792 $group = new ilTextInputGUI($this->lng->txt('ldap_group_name'), 'group');
793 $group->setInfo($this->lng->txt('ldap_group_name_info'));
794 $group->setSize(32);
795 $group->setMaxLength(255);
796 $this->form_gui->addItem($group);
797
798 $group_atrr = new ilTextInputGUI($this->lng->txt('ldap_group_attribute'), 'group_attribute');
799 $group_atrr->setInfo($this->lng->txt('ldap_group_attribute_info'));
800 $group_atrr->setSize(16);
801 $group_atrr->setMaxLength(64);
802 $this->form_gui->addItem($group_atrr);
803
804 $group_optional = new ilCheckboxInputGUI($this->lng->txt('ldap_group_membership'), 'group_optional');
805 $group_optional->setOptionTitle($this->lng->txt('ldap_group_member_optional'));
806 $group_optional->setInfo($this->lng->txt('ldap_group_optional_info'));
807 $group_optional->setValue(1);
808 $group_user_filter = new ilTextInputGUI($this->lng->txt('ldap_group_user_filter'), 'group_user_filter');
809 $group_user_filter->setSize(64);
810 $group_user_filter->setMaxLength(255);
811 $group_optional->addSubItem($group_user_filter);
812 $this->form_gui->addItem($group_optional);
813
814 $section_sync = new ilFormSectionHeaderGUI();
815 $section_sync->setTitle($this->lng->txt('ldap_user_sync'));
816 $this->form_gui->addItem($section_sync);
817
818 $ci_gui = new ilCustomInputGUI($this->lng->txt('ldap_moment_sync'));
819 $sync_on_login = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_login'), 'sync_on_login');
820 $sync_on_login->setValue(1);
821 $ci_gui->addSubItem($sync_on_login);
822 $sync_per_cron = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_cron'), 'sync_per_cron');
823 $sync_per_cron->setValue(1);
824 $ci_gui->addSubItem($sync_per_cron);
825 $ci_gui->setInfo($this->lng->txt('ldap_user_sync_info'));
826 $this->form_gui->addItem($ci_gui);
827
828 $global_role = new ilSelectInputGUI($this->lng->txt('ldap_global_role_assignment'), 'global_role');
829 $global_role->setOptions($this->prepareRoleSelect(false));
830 $global_role->setInfo($this->lng->txt('ldap_global_role_info'));
831 $this->form_gui->addItem($global_role);
832
833 $migr = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_migration'), 'migration');
834 $migr->setInfo($this->lng->txt('auth_ldap_migration_info'));
835 $migr->setValue(1);
836 $this->form_gui->addItem($migr);
837
838
839 include_once "Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php";
842 $this->form_gui,
844 );
845
846
847 $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
848 if ($_GET["cmd"] == "addServerSettings") {
849 $this->form_gui->addCommandButton('serverList', $this->lng->txt('cancel'));
850 }
851 }
852
853 /*
854 * Update Settings
855 */
856 public function save()
857 {
858 global $ilErr;
859
860 $this->setSubTabs();
861 $this->tabs_gui->setTabActive('settings');
862
863 $this->initForm();
864 if ($this->form_gui->checkInput()) {
865 $this->server->toggleActive((int) $this->form_gui->getInput('active'));
866 $this->server->enableAuthentication(!$this->form_gui->getInput('ds'));
867 $this->server->setName($this->form_gui->getInput('server_name'));
868 $this->server->setUrl($this->form_gui->getInput('server_url'));
869 $this->server->setVersion($this->form_gui->getInput('version'));
870 $this->server->setBaseDN($this->form_gui->getInput('base_dn'));
871 $this->server->toggleReferrer($this->form_gui->getInput('referrals'));
872 $this->server->toggleTLS($this->form_gui->getInput('tls'));
873 $this->server->setBindingType((int) $this->form_gui->getInput('binding_type'));
874 $this->server->setBindUser($this->form_gui->getInput('bind_dn'));
875 $this->server->setBindPassword($this->form_gui->getInput('bind_pass'));
876 $this->server->setSearchBase($this->form_gui->getInput('search_base'));
877 $this->server->setUserScope($this->form_gui->getInput('user_scope'));
878 $this->server->setUserAttribute($this->form_gui->getInput('user_attribute'));
879 $this->server->setFilter($this->form_gui->getInput('filter'));
880 $this->server->setGroupDN($this->form_gui->getInput('group_dn'));
881 $this->server->setGroupScope((int) $this->form_gui->getInput('group_scope'));
882 $this->server->setGroupFilter($this->form_gui->getInput('group_filter'));
883 $this->server->setGroupMember($this->form_gui->getInput('group_member'));
884 $this->server->enableGroupMemberIsDN((int) $this->form_gui->getInput('memberisdn'));
885 $this->server->setGroupName($this->form_gui->getInput('group'));
886 $this->server->setGroupAttribute($this->form_gui->getInput('group_attribute'));
887 $this->server->setGroupUserFilter($this->form_gui->getInput('group_user_filter'));
888 $this->server->toggleMembershipOptional((int) $this->form_gui->getInput('group_optional'));
889 $this->server->enableSyncOnLogin((int) $this->form_gui->getInput('sync_on_login'));
890 $this->server->enableSyncPerCron((int) $this->form_gui->getInput('sync_per_cron'));
891 $this->server->setGlobalRole((int) $this->form_gui->getInput('global_role'));
892 $this->server->enableAccountMigration((int) $this->form_gui->getInput('migration'));
893 // start Patch Name Filter
894 $this->server->setUsernameFilter($this->form_gui->getInput("name_filter"));
895 // end Patch Name Filter
896 if (!$this->server->validate()) {
897 ilUtil::sendFailure($ilErr->getMessage());
898 $this->form_gui->setValuesByPost();
899 return $this->tpl->setContent($this->form_gui->getHtml());
900 }
901
902 // Update or create
903 if ($this->server->getServerId()) {
904 $this->server->update();
905 } else {
906 $this->server->create();
907 }
908
909 // Now server_id exists => update LDAP attribute mapping
910 $this->initAttributeMapping();
911 $this->mapping->setRule('global_role', (int) $this->form_gui->getInput('global_role'), false);
912 $this->mapping->save();
913
914 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
915 $this->ctrl->redirect($this, 'serverList');
916 return true;
917 #$this->form_gui->setValuesByPost();
918 #return $this->tpl->setContent($this->form_gui->getHtml());
919 }
920
921 $this->form_gui->setValuesByPost();
922 return $this->tpl->setContent($this->form_gui->getHtml());
923 }
924
925
926
932 private function setSubTabs()
933 {
934 $this->tabs_gui->clearTargets();
935
936 $this->tabs_gui->setBackTarget(
937 $this->lng->txt("back"),
938 $this->ctrl->getLinkTarget($this, 'serverList')
939 );
940
941 /*$this->tabs_gui->addSubTabTarget("ldap_settings",
942 $this->ctrl->getLinkTarget($this,'serverList'),
943 "serverList",get_class($this));*/
944
945 $this->tabs_gui->addTab(
946 "settings",
947 $this->lng->txt("ldap_settings"),
948 $this->ctrl->getLinkTarget($this, 'editServerSettings')
949 );
950
951 // Disable all other tabs, if server hasn't been configured.
952 include_once('Services/LDAP/classes/class.ilLDAPServer.php');
953 if (!count(ilLDAPServer::_getServerList())) {
954 return true;
955 }
956
957 /*$this->tabs_gui->addSubTabTarget("ldap_user_mapping",
958 $this->ctrl->getLinkTarget($this,'userMapping'),
959 "userMapping",get_class($this));*/
960
961 $this->tabs_gui->addTab(
962 "user_mapping",
963 $this->lng->txt("ldap_user_mapping"),
964 $this->ctrl->getLinkTarget($this, 'userMapping')
965 );
966
967 /*$this->tabs_gui->addSubTabTarget('ldap_role_assignments',
968 $this->ctrl->getLinkTarget($this,'roleAssignments'),
969 "roleAssignments",get_class($this));*/
970
971 $this->tabs_gui->addTab(
972 "role_assignments",
973 $this->lng->txt('ldap_role_assignments'),
974 $this->ctrl->getLinkTarget($this, 'roleAssignments')
975 );
976
977 /*$this->tabs_gui->addSubTabTarget("ldap_role_mapping",
978 $this->ctrl->getLinkTarget($this,'roleMapping'),
979 "roleMapping",get_class($this));
980 "roleMapping",get_class($this));*/
981 $this->tabs_gui->addTab(
982 "role_mapping",
983 $this->lng->txt("ldap_role_mapping"),
984 $this->ctrl->getLinkTarget($this, 'roleMapping')
985 );
986 }
987
988
989 private function initServer()
990 {
991 include_once './Services/LDAP/classes/class.ilLDAPServer.php';
992 if (!$_REQUEST['ldap_server_id']) {
993 $_REQUEST['ldap_server_id'] = 0;
994 }
995 $this->server = new ilLDAPServer((int) $_REQUEST['ldap_server_id']);
996 }
997
998 private function initAttributeMapping()
999 {
1000 include_once './Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
1001 $this->mapping = ilLDAPAttributeMapping::_getInstanceByServerId($this->getServer()->getServerId());
1002 }
1003
1004 private function initRoleMapping()
1005 {
1006 include_once './Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php';
1007 $this->role_mapping = ilLDAPRoleGroupMappingSettings::_getInstanceByServerId($this->getServer()->getServerId());
1008 }
1009
1015 private function prepareGlobalRoleSelection($a_as_select = true)
1016 {
1017 global $rbacreview,$ilObjDataCache;
1018
1019 $global_roles = ilUtil::_sortIds(
1020 $rbacreview->getGlobalRoles(),
1021 'object_data',
1022 'title',
1023 'obj_id'
1024 );
1025
1026 $select[0] = $this->lng->txt('links_select_one');
1027 foreach ($global_roles as $role_id) {
1028 $select[$role_id] = ilObject::_lookupTitle($role_id);
1029 }
1030 return $select;
1031 }
1032
1033
1040 private function prepareRoleSelect($a_as_select = true)
1041 {
1042 global $rbacreview,$ilObjDataCache;
1043
1044 include_once('./Services/LDAP/classes/class.ilLDAPAttributeMapping.php');
1045
1046 $global_roles = ilUtil::_sortIds(
1047 $rbacreview->getGlobalRoles(),
1048 'object_data',
1049 'title',
1050 'obj_id'
1051 );
1052
1053 $select[0] = $this->lng->txt('links_select_one');
1054 foreach ($global_roles as $role_id) {
1055 $select[$role_id] = ilObject::_lookupTitle($role_id);
1056 }
1057
1058 if ($a_as_select) {
1059 return ilUtil::formSelect(
1060 ilLDAPAttributeMapping::_lookupGlobalRole($this->server->getServerId()),
1061 'global_role',
1062 $select,
1063 false,
1064 true
1065 );
1066 } else {
1067 return $select;
1068 }
1069 }
1070
1071
1072 private function getMappingFields()
1073 {
1074 return array('gender' => $this->lng->txt('gender'),
1075 'firstname' => $this->lng->txt('firstname'),
1076 'lastname' => $this->lng->txt('lastname'),
1077 'title' => $this->lng->txt('person_title'),
1078 'institution' => $this->lng->txt('institution'),
1079 'department' => $this->lng->txt('department'),
1080 'street' => $this->lng->txt('street'),
1081 'city' => $this->lng->txt('city'),
1082 'zipcode' => $this->lng->txt('zipcode'),
1083 'country' => $this->lng->txt('country'),
1084 'phone_office' => $this->lng->txt('phone_office'),
1085 'phone_home' => $this->lng->txt('phone_home'),
1086 'phone_mobile' => $this->lng->txt('phone_mobile'),
1087 'fax' => $this->lng->txt('fax'),
1088 'email' => $this->lng->txt('email'),
1089 'hobby' => $this->lng->txt('hobby'),
1090 'matriculation' => $this->lng->txt('matriculation'));
1091 #'photo' => $this->lng->txt('photo'));
1092 }
1093
1094 private function initUserDefinedFields()
1095 {
1096 include_once("./Services/User/classes/class.ilUserDefinedFields.php");
1097 $this->udf = ilUserDefinedFields::_getInstance();
1098 }
1099
1100 private function prepareMappingSelect()
1101 {
1102 return ilUtil::formSelect($_POST['mapping_template'], 'mapping_template', array(0 => $this->lng->txt('ldap_mapping_template'),
1103 "inetOrgPerson" => 'inetOrgPerson',
1104 "organizationalPerson" => 'organizationalPerson',
1105 "person" => 'person',
1106 "ad_2003" => 'Active Directory (Win 2003)'), false, true);
1107 }
1108
1115 private function loadMappingDetails()
1116 {
1117 if (!isset($_SESSION['ldap_mapping_details'])) {
1118 $_SESSION['ldap_mapping_details'] = array();
1119 }
1120 if (isset($_GET['details_show'])) {
1121 $_SESSION['ldap_mapping_details'][$_GET['details_show']] = $_GET['details_show'];
1122 }
1123 if (isset($_GET['details_hide'])) {
1124 unset($_SESSION['ldap_mapping_details'][$_GET['details_hide']]);
1125 }
1126 }
1127
1136 protected function initFormRoleAssignments($a_mode)
1137 {
1138 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
1139 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php');
1140
1141 $this->form = new ilPropertyFormGUI();
1142 $this->form->setFormAction($this->ctrl->getFormAction($this));
1143
1144 switch ($a_mode) {
1145 case 'edit':
1146 $this->form->setTitle($this->lng->txt('ldap_edit_role_ass_rule'));
1147 $this->form->addCommandButton('updateRoleAssignment', $this->lng->txt('save'));
1148 //$this->form->addCommandButton('roleAssignments',$this->lng->txt('cancel'));
1149 break;
1150 case 'create':
1151 $this->form->setTitle($this->lng->txt('ldap_add_role_ass_rule'));
1152 $this->form->addCommandButton('addRoleAssignment', $this->lng->txt('ldap_btn_add_role_ass'));
1153 //$this->form->addCommandButton('roleAssignments',$this->lng->txt('cancel'));
1154 break;
1155 }
1156
1157 // Role Selection
1158 $role = new ilRadioGroupInputGUI($this->lng->txt('ldap_ilias_role'), 'role_name');
1159 $role->setRequired(true);
1160
1161 $global = new ilRadioOption($this->lng->txt('ldap_global_role'), 0);
1162 $role->addOption($global);
1163
1164 $role_select = new ilSelectInputGUI('', 'role_id');
1165 $role_select->setOptions($this->prepareGlobalRoleSelection());
1166 $global->addSubItem($role_select);
1167
1168 $local = new ilRadioOption($this->lng->txt('ldap_local_role'), 1);
1169 $role->addOption($local);
1170
1171 include_once './Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php';
1172 $role_search = new ilRoleAutoCompleteInputGUI('', 'role_search', $this, 'addRoleAutoCompleteObject');
1173 $role_search->setSize(40);
1174 $local->addSubItem($role_search);
1175
1176 $role->setInfo($this->lng->txt('ldap_role_name_info'));
1177 $this->form->addItem($role);
1178
1179 // Update options
1180 $update = new ilNonEditableValueGUI($this->lng->txt('ldap_update_roles'), 'update_roles');
1181 $update->setValue($this->lng->txt('ldap_check_role_assignment'));
1182
1183 $add = new ilCheckboxInputGUI('', 'add_missing');
1184 $add->setOptionTitle($this->lng->txt('ldap_add_missing'));
1185 $update->addSubItem($add);
1186
1187 $remove = new ilCheckboxInputGUI('', 'remove_deprecated');
1188 $remove->setOptionTitle($this->lng->txt('ldap_remove_deprecated'));
1189 $update->addSubItem($remove);
1190
1191 $this->form->addItem($update);
1192
1193
1194
1195 // Assignment Type
1196 $group = new ilRadioGroupInputGUI($this->lng->txt('ldap_assignment_type'), 'type');
1197 #$group->setValue($current_rule->getType());
1198 $group->setRequired(true);
1199
1200 // Option by group
1201 $radio_group = new ilRadioOption($this->lng->txt('ldap_role_by_group'), ilLDAPRoleAssignmentRule::TYPE_GROUP);
1202
1203 $dn = new ilTextInputGUI($this->lng->txt('ldap_group_dn'), 'dn');
1204 #$dn->setValue($current_rule->getDN());
1205 $dn->setSize(32);
1206 $dn->setMaxLength(512);
1207 $dn->setInfo($this->lng->txt('ldap_role_grp_dn_info'));
1208 $radio_group->addSubItem($dn);
1209 $at = new ilTextInputGUI($this->lng->txt('ldap_role_grp_at'), 'at');
1210 #$at->setValue($current_rule->getMemberAttribute());
1211 $at->setSize(16);
1212 $at->setMaxLength(128);
1213 $radio_group->addSubItem($at);
1214 $isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_role_grp_isdn'), 'isdn');
1215 #$isdn->setChecked($current_rule->isMemberAttributeDN());
1216 $isdn->setInfo($this->lng->txt('ldap_group_member_info'));
1217 $radio_group->addSubItem($isdn);
1218 $radio_group->setInfo($this->lng->txt('ldap_role_grp_info'));
1219
1220 $group->addOption($radio_group);
1221
1222 // Option by Attribute
1223 $radio_attribute = new ilRadioOption($this->lng->txt('ldap_role_by_attribute'), ilLDAPRoleAssignmentRule::TYPE_ATTRIBUTE);
1224 $name = new ilTextInputGUI($this->lng->txt('ldap_role_at_name'), 'name');
1225 #$name->setValue($current_rule->getAttributeName());
1226 $name->setSize(32);
1227 $name->setMaxLength(128);
1228 #$name->setInfo($this->lng->txt('ldap_role_at_name_info'));
1229 $radio_attribute->addSubItem($name);
1230
1231 // Radio Attribute
1232 $val = new ilTextInputGUI($this->lng->txt('ldap_role_at_value'), 'value');
1233 #$val->setValue($current_rule->getAttributeValue());
1234 $val->setSize(32);
1235 $val->setMaxLength(128);
1236 #$val->setInfo($this->lng->txt('ldap_role_at_value_info'));
1237 $radio_attribute->addSubItem($val);
1238 $radio_attribute->setInfo($this->lng->txt('ldap_role_at_info'));
1239
1240 $group->addOption($radio_attribute);
1241
1242 // Option by Plugin
1243 $pl_active = (bool) $this->hasActiveRoleAssignmentPlugins();
1244 $pl = new ilRadioOption($this->lng->txt('ldap_plugin'), 3);
1245 $pl->setInfo($this->lng->txt('ldap_plugin_info'));
1246 $pl->setDisabled(!$pl_active);
1247
1248 $id = new ilNumberInputGUI($this->lng->txt('ldap_plugin_id'), 'plugin_id');
1249 $id->setDisabled(!$pl_active);
1250 $id->setSize(3);
1251 $id->setMaxLength(3);
1252 $id->setMaxValue(999);
1253 $id->setMinValue(1);
1254 $pl->addSubItem($id);
1255
1256 $group->addOption($pl);
1257 $this->form->addItem($group);
1258 }
1259
1265 {
1266 global $ilPluginAdmin;
1267
1268 return count($ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, 'LDAP', 'ldaphk')) ? true : false;
1269 }
1270
1271
1276 {
1277 include_once("./Services/Form/classes/class.ilRoleAutoCompleteInputGUI.php");
1279 }
1280
1281
1282
1283
1288 private function userMappingToolbar()
1289 {
1290 global $ilToolbar;
1291 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1292
1293 $select_form = new ilSelectInputGUI("mapping_template");
1294 $select_form->setPostVar("mapping_template");
1295 $options = array(
1296 "" => $this->lng->txt('ldap_mapping_template'),
1297 "inetOrgPerson" => 'inetOrgPerson',
1298 "organizationalPerson" => 'organizationalPerson',
1299 "person" => 'person',
1300 "ad_2003" => 'Active Directory (Win 2003)');
1301 $select_form->setOptions($options);
1302 $select_form->setValue($_POST['mapping_template']);
1303
1304 $ilToolbar->addInputItem($select_form);
1305 $ilToolbar->addFormButton($this->lng->txt('show'), "chooseMapping");
1306 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "chooseMapping"));
1307 }
1308
1313 private function initUserMappingForm()
1314 {
1315 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1316 $propertie_form = new ilPropertyFormGUI();
1317 $propertie_form->setTitle($this->lng->txt('ldap_mapping_table'));
1318 $propertie_form->setFormAction($this->ctrl->getFormAction($this, 'saveMapping'));
1319 $propertie_form->addCommandButton('saveMapping', $this->lng->txt('save'));
1320
1321 foreach ($this->getMappingFields() as $mapping => $lang) {
1322 $text_form = new ilTextInputGUI($lang);
1323 $text_form->setPostVar($mapping . "_value");
1324 $text_form->setValue($this->mapping->getValue($mapping));
1325 $text_form->setSize(32);
1326 $text_form->setMaxLength(255);
1327 $propertie_form->addItem($text_form);
1328
1329 $checkbox_form = new ilCheckboxInputGUI("");
1330 $checkbox_form->setPostVar($mapping . "_update");
1331 $checkbox_form->setChecked($this->mapping->enabledUpdate($mapping));
1332 $checkbox_form->setOptionTitle($this->lng->txt('ldap_update_field_info'));
1333 $propertie_form->addItem($checkbox_form);
1334 }
1335
1336 $this->initUserDefinedFields();
1337 foreach ($this->udf->getDefinitions() as $definition) {
1338 $text_form = new ilTextInputGUI($definition['field_name']);
1339 $text_form->setPostVar('udf_' . $definition['field_id'] . '_value');
1340 $text_form->setValue($this->mapping->getValue('udf_' . $definition['field_id']));
1341 $text_form->setSize(32);
1342 $text_form->setMaxLength(255);
1343 $propertie_form->addItem($text_form);
1344
1345 $checkbox_form = new ilCheckboxInputGUI("");
1346 $checkbox_form->setPostVar('udf_' . $definition['field_id'] . '_update');
1347 $checkbox_form->setChecked($this->mapping->enabledUpdate('udf_' . $definition['field_id']));
1348 $checkbox_form->setOptionTitle($this->lng->txt('ldap_update_field_info'));
1349 $propertie_form->addItem($checkbox_form);
1350 }
1351
1352 return $propertie_form;
1353 }
1354
1359 public function roleMapping()
1360 {
1361 global $ilToolbar;
1362 $this->setSubTabs();
1363 $this->tabs_gui->setTabActive('role_mapping');
1364 $ilToolbar->addButton(
1365 $this->lng->txt("ldap_new_role_assignment"),
1366 $this->ctrl->getLinkTarget($this, 'addRoleMapping')
1367 );
1368 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1369
1370 //Set propertyform for synchronization settings
1371 include_once("./Services/Form/classes/class.ilCombinationInputGUI.php");
1372 $propertie_form = new ilPropertyFormGUI();
1373 $propertie_form->setTitle($this->lng->txt('ldap_role_settings'));
1374 $propertie_form->setFormAction($this->ctrl->getFormAction($this, "saveSyncronizationSettings"));
1375 $propertie_form->addCommandButton("saveSyncronizationSettings", $this->lng->txt('save'));
1376 $role_active = new ilCheckboxInputGUI($this->lng->txt('ldap_role_active'));
1377 $role_active->setPostVar('role_sync_active');
1378 $role_active->setChecked($this->server->enabledRoleSynchronization() ? true : false);
1379 $propertie_form->addItem($role_active);
1380 $binding = new ilCombinationInputGUI($this->lng->txt('ldap_server_binding'));
1381 $binding->setInfo($this->lng->txt('ldap_role_bind_user_info'));
1382 $user = new ilTextInputGUI("");
1383 $user->setPostVar("role_bind_user");
1384 $user->setValue($this->server->getRoleBindDN());
1385 $user->setSize(50);
1386 $user->setMaxLength(255);
1387 $binding->addCombinationItem(0, $user, $this->lng->txt('ldap_role_bind_user'));
1388 $pass = new ilPasswordInputGUI("");
1389 $pass->setPostVar("role_bind_pass");
1390 $pass->setValue($this->server->getRoleBindPassword());
1391 $pass->setSize(12);
1392 $pass->setMaxLength(36);
1393 $pass->setRetype(false);
1394 $binding->addCombinationItem(1, $pass, $this->lng->txt('ldap_role_bind_pass'));
1395 $propertie_form->addItem($binding);
1396
1397 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_mappings.html', 'Services/LDAP');
1398 $this->tpl->setVariable("NEW_ASSIGNMENT_TBL", $propertie_form->getHTML());
1399
1400 //Set Group Assignments Table if mappings exist
1401 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php');
1402 $mapping_instance = ilLDAPRoleGroupMappingSettings::_getInstanceByServerId($this->server->getServerId());
1403 $mappings = $mapping_instance->getMappings();
1404 if (count($mappings)) {
1405 include_once("./Services/LDAP/classes/class.ilLDAPRoleMappingTableGUI.php");
1406 $table_gui = new ilLDAPRoleMappingTableGUI($this, $this->server->getServerId());
1407 $table_gui->setTitle($this->lng->txt('ldap_role_group_assignments'));
1408 $table_gui->setData($mappings);
1409 $this->tpl->setVariable("RULES_TBL", $table_gui->getHTML());
1410 }
1411 }
1412
1416 public function editRoleMapping()
1417 {
1418 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMappingSetting.php');
1419 $mapping = new ilLDAPRoleGroupMappingSetting($_GET["mapping_id"]);
1420 $mapping->read();
1421
1422 $propertie_form = $this->initRoleMappingForm("updateRoleMapping");
1423 $propertie_form->setTitle($this->lng->txt('ldap_edit_role_assignment'));
1424 $propertie_form->getItemByPostVar("url")->setValue($mapping->getURL());
1425 $propertie_form->getItemByPostVar("dn")->setValue($mapping->getDN());
1426 $propertie_form->getItemByPostVar("member")->setValue($mapping->getMemberAttribute());
1427 $propertie_form->getItemByPostVar("memberisdn")->setChecked($mapping->getMemberISDN());
1428 $propertie_form->getItemByPostVar("role")->setValue($mapping->getRoleName());
1429 $propertie_form->getItemByPostVar("info")->setValue($mapping->getMappingInfo());
1430 $propertie_form->getItemByPostVar("info_type")->setChecked($mapping->getMappingInfoType());
1431
1432 $this->tpl->setContent($propertie_form->getHTML());
1433 }
1434
1435
1436
1441 public function createRoleMapping()
1442 {
1443 global $rbacreview;
1444 $propertie_form = $this->initRoleMappingForm("createRoleMapping");
1445
1446 if ($propertie_form->checkInput() && $rbacreview->roleExists($propertie_form->getInput("role"))) {
1447 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMappingSetting.php');
1448 $mapping = new ilLDAPRoleGroupMappingSetting(0);
1449 $mapping->setServerId($this->server->getServerId());
1450 $mapping->setURL($propertie_form->getInput("url"));
1451 $mapping->setDN($propertie_form->getInput("dn"));
1452 $mapping->setMemberAttribute($propertie_form->getInput("member"));
1453 $mapping->setMemberISDN($propertie_form->getInput("memberisdn"));
1454 $mapping->setRoleByName($propertie_form->getInput("role"));
1455 $mapping->setMappingInfo($propertie_form->getInput("info"));
1456 $mapping->setMappingInfoType($propertie_form->getInput("info_type"));
1457 $mapping->save();
1458
1459 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1460 $this->ctrl->redirect($this, "roleMapping");
1461 } else {
1462 if (!$rbacreview->roleExists($propertie_form->getInput("role"))) {
1463 ilUtil::sendFailure($this->lng->txt("ldap_role_not_exists") . " " .
1464 $propertie_form->getInput("role"));
1465 }
1466 $propertie_form->setValuesByPost();
1467 $this->tpl->setContent($propertie_form->getHTML());
1468 }
1469 }
1470
1475 {
1476 if (!is_array($_POST['mappings'])) {
1477 ilUtil::sendFailure($this->lng->txt('select_one'), true);
1478 $this->ctrl->redirect($this, "roleMapping");
1479 return false;
1480 }
1481
1482 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1483 $c_gui = new ilConfirmationGUI();
1484
1485 // set confirm/cancel commands
1486 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteRoleMapping"));
1487 $c_gui->setHeaderText($this->lng->txt("ldap_confirm_del_role_ass"));
1488 $c_gui->setCancel($this->lng->txt("cancel"), "roleMapping");
1489 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteRoleMapping");
1490
1491 foreach ($_POST['mappings'] as $id) {
1492 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMappingSetting.php');
1493 $mapping = new ilLDAPRoleGroupMappingSetting($id);
1494 $mapping->read();
1495 $txt = $this->lng->txt('obj_role') . ": " . $mapping->getRoleName() . ", ";
1496 $txt .= $this->lng->txt('ldap_group_dn') . ": " . $mapping->getDN() . ", ";
1497 $txt .= $this->lng->txt('ldap_server_short') . " " . $mapping->getURL() . ", ";
1498 $txt .= $this->lng->txt('ldap_group_member_short') . " " . $mapping->getMemberAttribute();
1499
1500 $c_gui->addItem("mappings[]", $id, $txt);
1501 }
1502 $this->tpl->setContent($c_gui->getHTML());
1503 }
1504
1505 public function addServerSettings()
1506 {
1507 $this->ctrl->clearParameters($this);
1508
1509 $this->initForm();
1510 return $this->tpl->setContent($this->form_gui->getHtml());
1511 }
1512
1513 public function editServerSettings()
1514 {
1515 $this->setSubTabs();
1516 $this->tabs_gui->setTabActive('settings');
1517
1518 $this->initForm();
1519 $this->setServerFormValues();
1520 return $this->tpl->setContent($this->form_gui->getHtml());
1521 }
1522
1523
1532 {
1533 if (!isset($_GET["ldap_server_id"])) {
1534 ilUtil::sendFailure($this->lng->txt('select_one'));
1535 $this->serverList();
1536 return false;
1537 }
1538
1539 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1540 $c_gui = new ilConfirmationGUI();
1541
1542 // set confirm/cancel commands
1543 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteServerSettings"));
1544 $c_gui->setHeaderText($this->lng->txt("ldap_confirm_del_server_settings"));
1545 $c_gui->setCancel($this->lng->txt("cancel"), "serverList");
1546 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteServerSettings");
1547
1548 // add items to delete
1549 include_once('Services/LDAP/classes/class.ilLDAPServer.php');
1550 foreach ((array) $_GET["ldap_server_id"] as $server_id) {
1551 $setting = new ilLDAPServer($server_id);
1552 $c_gui->addItem('server_ids[]', $server_id, $setting->getName());
1553 }
1554 $this->tpl->setContent($c_gui->getHTML());
1555 }
1556
1560 public function deleteServerSettings()
1561 {
1562 if (!is_array($_POST["server_ids"])) {
1563 ilUtil::sendFailure($this->lng->txt('select_one'));
1564 $this->serverList();
1565 return false;
1566 }
1567
1568 foreach ((array) $_POST["server_ids"] as $server_id) {
1569 $setting = new ilLDAPServer($server_id);
1570 $setting->delete();
1571 }
1572 ilUtil::sendSuccess($this->lng->txt('deleted'));
1573
1574 $this->serverList();
1575 }
1576
1580 public function userMapping()
1581 {
1582 $this->initAttributeMapping();
1583
1584 $this->setSubTabs();
1585 $this->tabs_gui->setTabActive('user_mapping');
1586 $this->userMappingToolbar();
1587
1588 $propertie_form = $this->initUserMappingForm();
1589
1590 $this->tpl->setContent($propertie_form->getHTML());
1591 }
1592
1593
1594
1595 public function activateServer()
1596 {
1597 $this->server->toggleActive(1);
1598 $this->server->update();
1599 $this->serverList();
1600 }
1601
1602 public function deactivateServer()
1603 {
1604 $this->server->toggleActive(0);
1605 $this->server->update();
1606 $this->serverList();
1607 }
1608
1609
1610
1611
1617 private function initRoleMappingForm($command)
1618 {
1619 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1620 $this->setSubTabs();
1621 $this->tabs_gui->setTabActive('role_mapping');
1622
1623 if (isset($_GET["mapping_id"])) {
1624 $this->ctrl->setParameter($this, 'mapping_id', $_GET["mapping_id"]);
1625 }
1626
1627 $propertie_form = new ilPropertyFormGUI();
1628 $propertie_form->setTitle($this->lng->txt('ldap_mapping_table'));
1629 $propertie_form->setFormAction($this->ctrl->getFormAction($this, $command));
1630 $propertie_form->addCommandButton($command, $this->lng->txt('save'));
1631 $propertie_form->addCommandButton("roleMapping", $this->lng->txt('cancel'));
1632
1633 $url = new ilTextInputGUI($this->lng->txt('ldap_server'));
1634 $url->setPostVar("url");
1635 $url->setSize(50);
1636 $url->setMaxLength(255);
1637 $url->setRequired(true);
1638
1639 $group_dn = new ilTextInputGUI($this->lng->txt('ldap_group_dn'));
1640 $group_dn->setPostVar("dn");
1641 $group_dn->setSize(50);
1642 $group_dn->setMaxLength(255);
1643 $group_dn->setInfo($this->lng->txt('ldap_dn_info'));
1644 $group_dn->setRequired(true);
1645
1646 $member = new ilTextInputGUI($this->lng->txt('ldap_group_member'));
1647 $member->setPostVar("member");
1648 $member->setSize(32);
1649 $member->setMaxLength(255);
1650 $member->setInfo($this->lng->txt('ldap_member_info'));
1651 $member->setRequired(true);
1652
1653 $member_isdn = new ilCheckboxInputGUI("");
1654 $member_isdn->setPostVar("memberisdn");
1655 $member_isdn->setOptionTitle($this->lng->txt('ldap_memberisdn'));
1656
1657 $role = new ilTextInputGUI($this->lng->txt('ldap_ilias_role'));
1658 $role->setPostVar("role");
1659 $role->setSize(32);
1660 $role->setMaxLength(255);
1661 $role->setInfo($this->lng->txt('ldap_role_info'));
1662 $role->setRequired(true);
1663
1664 $info = new ilTextAreaInputGUI($this->lng->txt('ldap_info_text'));
1665 $info->setPostVar("info");
1666 $info->setCols(50);
1667 $info->setRows(3);
1668 $info->setInfo($this->lng->txt('ldap_info_text_info'));
1669
1670 $info_type = new ilCheckboxInputGUI("");
1671 $info_type->setPostVar("info_type");
1672 $info_type->setOptionTitle($this->lng->txt('ldap_mapping_info_type'));
1673
1674 $propertie_form->addItem($url);
1675 $propertie_form->addItem($group_dn);
1676 $propertie_form->addItem($member);
1677 $propertie_form->addItem($member_isdn);
1678 $propertie_form->addItem($role);
1679 $propertie_form->addItem($info);
1680 $propertie_form->addItem($info_type);
1681
1682 return $propertie_form;
1683 }
1684
1685
1686
1690 public function addRoleMapping()
1691 {
1692 $propertie_form = $this->initRoleMappingForm("createRoleMapping");
1693 $propertie_form->getItemByPostVar("url")->setValue($this->server->getUrl());
1694
1695 if (isset($_GET["mapping_id"])) {
1696 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMappingSetting.php');
1697 $mapping = new ilLDAPRoleGroupMappingSetting($_GET["mapping_id"]);
1698 $mapping->read();
1699
1700 $propertie_form->getItemByPostVar("url")->setValue($mapping->getURL());
1701 $propertie_form->getItemByPostVar("dn")->setValue($mapping->getDN());
1702 $propertie_form->getItemByPostVar("member")->setValue($mapping->getMemberAttribute());
1703 $propertie_form->getItemByPostVar("memberisdn")->setChecked($mapping->getMemberISDN());
1704 $propertie_form->getItemByPostVar("role")->setValue($mapping->getRoleName());
1705 $propertie_form->getItemByPostVar("info")->setValue($mapping->getMappingInfo());
1706 $propertie_form->getItemByPostVar("info_type")->setChecked($mapping->getMappingInfoType());
1707 }
1708
1709 $this->tpl->setContent($propertie_form->getHTML());
1710 }
1711
1712
1717 public function updateRoleMapping()
1718 {
1719 global $rbacreview;
1720 $propertie_form = $this->initRoleMappingForm("updateRoleMapping");
1721
1722 if ($propertie_form->checkInput() && $rbacreview->roleExists($propertie_form->getInput("role"))) {
1723 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMappingSetting.php');
1724 $mapping = new ilLDAPRoleGroupMappingSetting($_GET["mapping_id"]);
1725 $mapping->setServerId($this->server->getServerId());
1726 $mapping->setURL($propertie_form->getInput("url"));
1727 $mapping->setDN($propertie_form->getInput("dn"));
1728 $mapping->setMemberAttribute($propertie_form->getInput("member"));
1729 $mapping->setMemberISDN($propertie_form->getInput("memberisdn"));
1730 $mapping->setRoleByName($propertie_form->getInput("role"));
1731 $mapping->setMappingInfo($propertie_form->getInput("info"));
1732 $mapping->setMappingInfoType($propertie_form->getInput("info_type"));
1733 $mapping->update();
1734
1735 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1736 $this->ctrl->redirect($this, "roleMapping");
1737 } else {
1738 if (!$rbacreview->roleExists($propertie_form->getInput("role"))) {
1739 ilUtil::sendFailure($this->lng->txt("ldap_role_not_exists") . " " .
1740 $propertie_form->getInput("role"));
1741 }
1742 $propertie_form->setValuesByPost();
1743 $this->tpl->setContent($propertie_form->getHTML());
1744 }
1745 }
1746
1751 {
1752 $this->server->setRoleBindDN(ilUtil::stripSlashes($_POST['role_bind_user']));
1753 $this->server->setRoleBindPassword(ilUtil::stripSlashes($_POST['role_bind_pass']));
1754 $this->server->enableRoleSynchronization((int) $_POST['role_sync_active']);
1755
1756 // Update or create
1757 if ($this->server->getServerId()) {
1758 $this->server->update();
1759 }
1760 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1761 $this->ctrl->redirect($this, "roleMapping");
1762 }
1763}
$parser
Definition: BPMN2Parser.php:23
$tpl
Definition: ilias.php:10
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
const IL_LDAP_BIND_USER
const IL_LDAP_BIND_ANONYMOUS
const IL_LDAP_SCOPE_SUB
const IL_LDAP_SCOPE_ONE
const QP_COMBINATION_AND
static addFieldsToForm($a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
This class represents a checkbox property in a property form.
This class represents a number property in a property form.
Confirmation screen class.
This class represents a custom property in a property form.
This class represents a section header in a property form.
static _getMappingRulesByClass($a_class)
Get mapping rule by objectClass.
static _lookupGlobalRole($a_server_id)
Lookup global role assignment.
static _getInstanceByServerId($a_server_id)
Get instance of class.
static _getRules($a_server_id)
Get all rules.
static _getInstanceByRuleId($a_rule_id)
get instance by rule id
static _getInstanceByServerId($a_server_id)
Get instance of class.
static _getServerList()
Get list of all configured servers.
static checkLDAPLib()
Check if ldap module is installed.
setSubTabs()
Set sub tabs for ldap section.
editRoleMapping()
Edit Assigments for role mapping.
checkRoleAssignmentInput($a_rule_id=0)
Check role assignment input.
prepareRoleSelect($a_as_select=true)
Used for old style table.
userMapping()
Ldap User Mapping.
saveRoleSelection()
Save role selection.
userMappingToolbar()
Create Toolbar @global ilToolbarGUI $ilToolbar.
loadRoleAssignmentRule($a_rule_id, $a_from_form=true)
Load input from form.
editRoleAssignment()
Edit role assignment.
roleAssignments()
Edit role assignments.
initUserMappingForm()
Create Property Form GUI for User Mapping.
addRoleAutoCompleteObject()
Add Member for autoComplete.
saveSyncronizationSettings()
save Syncronization Settings on Role Mapping screen
confirmDeleteRoleMapping()
confirm delete role mappings
prepareGlobalRoleSelection($a_as_select=true)
New implementation for InputForm.
roleMapping()
Role Mapping Tab @global ilToolbarGUI $ilToolbar.
hasActiveRoleAssignmentPlugins()
Check if the plugin is active.
getServer()
Get server settings.
confirmDeleteRules()
Confirm delete rules.
confirmDeleteServerSettings()
Confirm delete rules.
createRoleMapping()
Check add screen input and save to db @global ilRbacReview $rbacreview.
setValuesByArray()
set values of form array
showRoleSelection()
show role selection
loadMappingDetails()
Load info about hide/show details.
updateRoleAssignment()
update role assignment
addRoleAssignment()
add new role assignment
addRoleMapping()
Add Assigments for role mapping.
getRoleAssignmentTable()
Show active role assignments.
initFormRoleAssignments($a_mode)
Init form table for new role assignments.
deleteRules()
delete role assignment rule
updateRoleMapping()
Check edit screen input and save to db @global ilRbacReview $rbacreview.
initRoleMappingForm($command)
init propertyformgui for Assignment of LDAP Attributes to ILIAS User Profile
This class represents a non editable value in a property form.
This class represents a number property in a property form.
static _lookupTitle($a_id)
lookup object title
This class represents a password property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a role + autocomplete feature form input.
static echoAutoCompleteList()
Static asynchronous default auto complete function.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static _getInstance()
Get instance.
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,...
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
$lang
Definition: consent.php:3
$key
Definition: croninfo.php:18
$txt
Definition: error.php:11
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
if($format !==null) $name
Definition: metadata.php:146
$info
Definition: index.php:5
$binding
global $lng
Definition: privfeed.php:17
$url
if(empty($password)) $table
Definition: pwgen.php:24
global $ilErr
Definition: raiseError.php:16
foreach($_POST as $key=> $value) $res
$rule
Definition: showstats.php:43