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