ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilLDAPSettingsGUI Class Reference
+ Collaboration diagram for ilLDAPSettingsGUI:

Public Member Functions

 __construct (int $a_auth_ref_id)
 
 executeCommand ()
 
 getServer ()
 Get server settings. More...
 
 roleAssignments ()
 Edit role assignments. More...
 
 editRoleAssignment ()
 Edit role assignment. More...
 
 updateRoleAssignment ()
 update role assignment More...
 
 confirmDeleteRules ()
 Confirm delete rules. More...
 
 deleteRules ()
 delete role assignment rule More...
 
 addRoleAssignment ()
 add new role assignment More...
 
 deleteRoleMapping ()
 
 chooseMapping ()
 
 saveMapping ()
 
 setServerFormValues ()
 
 save ()
 
 addRoleAutoCompleteObject ()
 Add Member for autoComplete. More...
 
 roleMapping ()
 Role Mapping Tab. More...
 
 editRoleMapping ()
 Edit Assigments for role mapping. More...
 
 createRoleMapping ()
 Check add screen input and save to db. More...
 
 confirmDeleteRoleMapping ()
 confirm delete role mappings More...
 
 addServerSettings ()
 
 editServerSettings ()
 
 confirmDeleteServerSettings ()
 Confirm delete rules. More...
 
 deleteServerSettings ()
 
 userMapping ()
 Ldap User Mapping. More...
 
 activateServer ()
 
 deactivateServer ()
 
 addRoleMapping ()
 Add Assigments for role mapping. More...
 
 updateRoleMapping ()
 Check edit screen input and save to db. More...
 
 saveSyncronizationSettings ()
 save Syncronization Settings on Role Mapping screen More...
 

Protected Member Functions

 showRoleSelection ()
 show role selection More...
 
 saveRoleSelection ()
 Save role selection. More...
 
 getRoleAssignmentTable ()
 Show active role assignments. More...
 
 initFormRoleAssignments (string $a_mode)
 Init form table for new role assignments. More...
 

Private Member Functions

 checkAccess (string $a_permission)
 
 getAttributeMappingKeys ()
 Get all possible attribute keys for mapping ldap attribute to ilias user attributes. More...
 
 setValuesByArray ()
 set values of form array More...
 
 roleSelectionRequired ()
 
 checkRoleAssignmentInput (int $a_rule_id=0)
 Check role assignment input. More...
 
 loadRoleAssignmentRule (int $a_rule_id, bool $load_from_form=true)
 Load input from form. More...
 
 handleServerTableActions ()
 
 serverList ()
 
 initForm ()
 
 setSubTabs ()
 Set sub tabs for ldap section. More...
 
 initServer ()
 
 initAttributeMapping ()
 
 initRoleMapping ()
 
 prepareGlobalRoleSelection ()
 New implementation for InputForm. More...
 
 getMappingFields ()
 
 initUserDefinedFields ()
 
 prepareMappingSelect ()
 
 userMappingToolbar ()
 Create Toolbar. More...
 
 initUserMappingForm ()
 Create Property Form GUI for User Mapping. More...
 
 initRoleMappingForm (string $command)
 init propertyformgui for Assignment of LDAP Attributes to ILIAS User Profile More...
 

Private Attributes

int $ref_id
 
ilLDAPServer $server
 
ilLDAPAttributeMapping $mapping
 
ilPropertyFormGUI $form_gui = null
 
ilPropertyFormGUI $form = null
 
ilCtrl $ctrl
 
ilTabsGUI $tabs_gui
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilErrorHandling $ilErr
 
ilAccessHandler $ilAccess
 
ilRbacReview $rbacReview
 
ilRbacSystem $rbacSystem
 
ilToolbarGUI $toolbar
 
ilGlobalTemplateInterface $main_tpl
 
ilComponentRepository $component_repository
 
ilUserDefinedFields $udf
 
ilLDAPRoleAssignmentRule $role_mapping_rule = null
 
ilLDAPRoleAssignmentRule $rule = null
 
ilLDAPRoleGroupMappingSettings $role_mapping = null
 
array $rule_ids = null
 
int $rule_id = null
 
int $role_id = null
 
array $mappings = null
 
string $mapping_template = null
 
int $ldap_server_id = null
 
array $server_ids = null
 
int $mapping_id = null
 
string $role_bind_user = null
 
string $role_bind_pass = null
 
bool $role_sync_active = false
 
array $attribute_mappings = []
 
readonly ILIAS UI Factory $ui_factory
 
readonly ILIAS UI Renderer $ui_renderer
 
readonly ILIAS HTTP GlobalHttpState $http
 
readonly ILIAS Refinery Factory $refinery
 
readonly ilObjectDataCache $object_data_cache
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 27 of file class.ilLDAPSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLDAPSettingsGUI::__construct ( int  $a_auth_ref_id)
Exceptions
ilCtrlException

Definition at line 76 of file class.ilLDAPSettingsGUI.php.

References $DIC, ilLDAPRoleGroupMappingSettings\_getInstanceByServerId(), ilLDAPRoleAssignmentRule\_getRules(), ILIAS\Repository\ctrl(), getAttributeMappingKeys(), ilLDAPRoleAssignmentRule\getRuleId(), ILIAS\FileDelivery\http(), initServer(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\UI\examples\Progress\Bar\server(), ilUtil\stripSlashes(), ILIAS\Repository\toolbar(), and ILIAS\Refinery\transform().

77  {
78  global $DIC;
79 
80  $this->ctrl = $DIC->ctrl();
81  $this->tabs_gui = $DIC->tabs();
82  $this->lng = $DIC->language();
83  $this->lng->loadLanguageModule('ldap');
84  $this->lng->loadLanguageModule('ui');
85  $this->ilErr = $DIC['ilErr'];
86  $this->ilAccess = $DIC->access();
87  $this->component_repository = $DIC["component.repository"];
88  $this->rbacReview = $DIC->rbac()->review();
89  $this->rbacSystem = $DIC->rbac()->system();
90  $this->toolbar = $DIC->toolbar();
91  $this->main_tpl = $DIC->ui()->mainTemplate();
92  $this->http = $DIC->http();
93  $this->ui_factory = $DIC->ui()->factory();
94  $this->ui_renderer = $DIC->ui()->renderer();
95  $this->refinery = $DIC->refinery();
96  $this->object_data_cache = $DIC['ilObjDataCache'];
97 
98  $this->tpl = $DIC->ui()->mainTemplate();
99 
100  if ($this->ctrl->getCmd() !== "addServerSettings") {
101  $this->ctrl->saveParameter($this, 'ldap_server_id');
102  }
103 
104  $http_wrapper = $DIC->http()->wrapper();
105  $is_post_request = $DIC->http()->request()->getMethod() === "POST";
106  $refinery = $DIC->refinery();
107  if ($http_wrapper->query()->has("rule_id")) {
108  $this->rule_id = $http_wrapper->query()->retrieve(
109  "rule_id",
110  $refinery->kindlyTo()->int()
111  );
112  }
113 
114  if ($http_wrapper->query()->has('ldap_server_id')) {
115  $this->ldap_server_id = $http_wrapper->query()->retrieve(
116  'ldap_server_id',
117  $refinery->kindlyTo()->int()
118  );
119  } elseif ($http_wrapper->query()->has('ldap_servers_server_id')) {
120  $this->ldap_server_id = $http_wrapper->query()->retrieve(
121  'ldap_servers_server_id',
122  $this->refinery->in()->series([
123  $refinery->kindlyTo()->listOf(
124  $refinery->kindlyTo()->int()
125  ),
126  $this->refinery->custom()->constraint(
127  fn($value): bool => count($value) === 1,
128  $this->lng->txt('select_one')
129  ),
130  $this->refinery->custom()->transformation(
131  fn($value): int => $value[0]
132  )
133  ])
134  );
135  }
136  $this->initServer();
137 
138 
139  if ($http_wrapper->query()->has("mapping_id")) {
140  $this->mapping_id = $http_wrapper->query()->retrieve(
141  "mapping_id",
142  $refinery->kindlyTo()->int()
143  );
144  }
145  if ($http_wrapper->query()->has('ldap_role_mapping_mapping_ids')) {
146  $this->mappings = $http_wrapper->query()->retrieve(
147  'ldap_role_mapping_mapping_ids',
148  $refinery->kindlyTo()->listOf($refinery->kindlyTo()->string())
149  );
150  if ($this->mappings === ['ALL_OBJECTS']) {
151  $mapping_instance = ilLDAPRoleGroupMappingSettings::_getInstanceByServerId($this->server->getServerId());
152  $this->mappings = array_map(static function (array $mapping): int {
153  return $mapping['mapping_id'];
154  }, $mapping_instance->getMappings());
155  }
156  $this->mappings = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform($this->mappings);
157  if (count($this->mappings) === 1) {
158  $this->mapping_id = current($this->mappings);
159  }
160  }
161  if ($http_wrapper->query()->has('ldap_role_assignment_rule_ids')) {
162  $this->rule_ids = $http_wrapper->query()->retrieve(
163  'ldap_role_assignment_rule_ids',
164  $refinery->kindlyTo()->listOf($refinery->kindlyTo()->string())
165  );
166  if ($this->rule_ids === ['ALL_OBJECTS']) {
167  $rule_objs = ilLDAPRoleAssignmentRule::_getRules($this->server->getServerId());
168  $this->rule_ids = array_map(static function (ilLDAPRoleAssignmentRule $rule): int {
169  return $rule->getRuleId();
170  }, $rule_objs);
171  }
172  $this->rule_ids = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform($this->rule_ids);
173  if (count($this->rule_ids) === 1) {
174  $this->rule_id = current($this->rule_ids);
175  }
176  }
177  if ($is_post_request) {
178  if ($http_wrapper->post()->has('rule_ids')) {
179  $this->rule_ids = $http_wrapper->post()->retrieve(
180  'rule_ids',
181  $refinery->kindlyTo()->listOf($refinery->kindlyTo()->int())
182  );
183  }
184  if ($http_wrapper->post()->has('role_id')) {
185  $this->role_id = $http_wrapper->post()->retrieve(
186  'role_id',
187  $refinery->kindlyTo()->int()
188  );
189  }
190  if ($http_wrapper->post()->has('rule_id')) {
191  $this->rule_id = $http_wrapper->post()->retrieve(
192  'rule_id',
193  $refinery->kindlyTo()->int()
194  );
195  }
196  if ($http_wrapper->post()->has('mappings')) {
197  $this->mappings = $http_wrapper->post()->retrieve(
198  'mappings',
199  $refinery->kindlyTo()->listOf($refinery->kindlyTo()->int())
200  );
201  }
202  if ($http_wrapper->post()->has('server_ids')) {
203  $this->server_ids = $http_wrapper->post()->retrieve(
204  'server_ids',
205  $refinery->kindlyTo()->listOf($refinery->kindlyTo()->int())
206  );
207  }
208  if ($http_wrapper->post()->has('mapping_template')) {
209  $this->mapping_template = $http_wrapper->post()->retrieve(
210  'mapping_template',
211  $refinery->kindlyTo()->string()
212  );
213  }
214  if ($http_wrapper->post()->has('role_bind_user')) {
215  $this->role_bind_user = ilUtil::stripSlashes($http_wrapper->post()->retrieve(
216  'role_bind_user',
217  $refinery->kindlyTo()->string()
218  ));
219  }
220  if ($http_wrapper->post()->has('role_bind_pass')) {
221  $this->role_bind_pass = ilUtil::stripSlashes($http_wrapper->post()->retrieve(
222  'role_bind_pass',
223  $refinery->kindlyTo()->string()
224  ));
225  }
226  if ($http_wrapper->post()->has('role_sync_active')) {
227  $this->role_sync_active = $http_wrapper->post()->retrieve(
228  'role_sync_active',
229  $refinery->kindlyTo()->bool()
230  );
231  }
232  foreach ($this->getAttributeMappingKeys() as $key) {
233  if ($http_wrapper->post()->has($key . '_value')) {
234  $this->attribute_mappings[$key] = [ilUtil::stripSlashes($http_wrapper->post()->retrieve(
235  $key . '_value',
236  $refinery->kindlyTo()->string()
237  )), $http_wrapper->post()->has($key . '_update')];
238  } else {
239  $this->attribute_mappings[$key] = ["", false];
240  }
241  }
242  }
243 
244  $this->ref_id = $a_auth_ref_id;
245  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
readonly ILIAS Refinery Factory $refinery
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
static _getRules($a_server_id)
Get all rules.
static http()
Fetches the global http state from ILIAS.
ilLDAPAttributeMapping $mapping
global $DIC
Definition: shib_login.php:26
static _getInstanceByServerId(int $a_server_id)
Get instance of class.
getAttributeMappingKeys()
Get all possible attribute keys for mapping ldap attribute to ilias user attributes.
ilLDAPRoleAssignmentRule $rule
+ Here is the call graph for this function:

Member Function Documentation

◆ activateServer()

ilLDAPSettingsGUI::activateServer ( )

Definition at line 1688 of file class.ilLDAPSettingsGUI.php.

References checkAccess(), ILIAS\UI\examples\Progress\Bar\server(), and serverList().

Referenced by handleServerTableActions().

1688  : void
1689  {
1690  $this->checkAccess("write");
1691 
1692  $this->server->toggleActive(true);
1693  $this->server->update();
1694  $this->serverList();
1695  }
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
checkAccess(string $a_permission)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRoleAssignment()

ilLDAPSettingsGUI::addRoleAssignment ( )

add new role assignment

Definition at line 476 of file class.ilLDAPSettingsGUI.php.

References checkRoleAssignmentInput(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), initFormRoleAssignments(), ILIAS\Repository\lng(), roleAssignments(), roleSelectionRequired(), and setSubTabs().

476  : bool
477  {
478  if (!$this->ilAccess->checkAccess('write', '', $this->ref_id)) {
479  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
480  $this->roleAssignments();
481  return false;
482  }
483  $this->setSubTabs();
484  $this->initFormRoleAssignments('create');
485  $formWithoutErrors = $this->form->checkInput();
486  $roleErrorMessage = $this->checkRoleAssignmentInput();
487  if (!$formWithoutErrors || $roleErrorMessage !== '') {
488  if ($roleErrorMessage !== '') {
489  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt($roleErrorMessage));
490  }
491 
492  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_assignments.html', 'components/ILIAS/LDAP');
493 
494  // DONE: wrap this
495  $this->form->setValuesByPost();
496  $this->tpl->setVariable('NEW_ASSIGNMENT_TBL', $this->form->getHTML());
497  $this->tpl->setVariable('RULES_TBL', $this->ui_renderer->render($this->getRoleAssignmentTable()));
498  $this->tabs_gui->activateSubTab('role_assignments');
499  return true;
500  }
501 
502  if ($this->roleSelectionRequired()) {
503  $this->ctrl->redirect($this, 'showRoleSelection');
504  } else {
505  $this->rule->create();
506  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
507  $this->ctrl->redirect($this, 'roleAssignments');
508  }
509  return true;
510  }
checkRoleAssignmentInput(int $a_rule_id=0)
Check role assignment input.
initFormRoleAssignments(string $a_mode)
Init form table for new role assignments.
setSubTabs()
Set sub tabs for ldap section.
roleAssignments()
Edit role assignments.
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ addRoleAutoCompleteObject()

ilLDAPSettingsGUI::addRoleAutoCompleteObject ( )

Add Member for autoComplete.

Definition at line 1375 of file class.ilLDAPSettingsGUI.php.

References ilRoleAutoCompleteInputGUI\echoAutoCompleteList().

1375  : void
1376  {
1378  }
static echoAutoCompleteList()
Static asynchronous default auto complete function.
+ Here is the call graph for this function:

◆ addRoleMapping()

ilLDAPSettingsGUI::addRoleMapping ( )

Add Assigments for role mapping.

Definition at line 1785 of file class.ilLDAPSettingsGUI.php.

References initRoleMappingForm(), ilLDAPAttributeMapping\read(), and ILIAS\UI\examples\Progress\Bar\server().

1785  : void
1786  {
1787  $propertie_form = $this->initRoleMappingForm("createRoleMapping");
1788  if ($propertie_form->getItemByPostVar("url")) {
1789  $propertie_form->getItemByPostVar("url")->setValue($this->server->getUrl());
1790  }
1791  if ($this->mapping_id) {
1792  $mapping = new ilLDAPRoleGroupMappingSetting($this->mapping_id);
1793  $mapping->read();
1794  if ($propertie_form->getItemByPostVar("url")) {
1795  $propertie_form->getItemByPostVar("url")->setValue($mapping->getURL());
1796  }
1797  if ($propertie_form->getItemByPostVar("dn")) {
1798  $propertie_form->getItemByPostVar("dn")->setValue($mapping->getDN());
1799  }
1800  if ($propertie_form->getItemByPostVar("member")) {
1801  $propertie_form->getItemByPostVar("member")->setValue($mapping->getMemberAttribute());
1802  }
1803  if ($propertie_form->getItemByPostVar("memberisdn")) {
1804  $propertie_form->getItemByPostVar("memberisdn")->setChecked($mapping->getMemberISDN());
1805  }
1806  if ($propertie_form->getItemByPostVar("role")) {
1807  $propertie_form->getItemByPostVar("role")->setValue($mapping->getRoleName());
1808  }
1809  if ($propertie_form->getItemByPostVar("info")) {
1810  $propertie_form->getItemByPostVar("info")->setValue($mapping->getMappingInfo());
1811  }
1812  if ($propertie_form->getItemByPostVar("info_type")) {
1813  $propertie_form->getItemByPostVar("info_type")->setChecked($mapping->getMappingInfoType());
1814  }
1815  }
1816 
1817  $this->tpl->setContent($propertie_form->getHTML());
1818  }
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
ilLDAPAttributeMapping $mapping
read()
Read mapping settings from db.
initRoleMappingForm(string $command)
init propertyformgui for Assignment of LDAP Attributes to ILIAS User Profile
+ Here is the call graph for this function:

◆ addServerSettings()

ilLDAPSettingsGUI::addServerSettings ( )

Definition at line 1600 of file class.ilLDAPSettingsGUI.php.

References checkAccess(), ILIAS\Repository\ctrl(), and initForm().

1600  : void
1601  {
1602  $this->checkAccess("write");
1603 
1604  $this->ctrl->clearParameters($this);
1605 
1606  $this->initForm();
1607  $this->tpl->setContent($this->form_gui->getHTML());
1608  }
checkAccess(string $a_permission)
+ Here is the call graph for this function:

◆ checkAccess()

ilLDAPSettingsGUI::checkAccess ( string  $a_permission)
private

Definition at line 282 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\lng().

Referenced by activateServer(), addServerSettings(), confirmDeleteRules(), confirmDeleteServerSettings(), deactivateServer(), and editServerSettings().

282  : void
283  {
284  if (!$this->ilAccess->checkAccess($a_permission, '', $this->ref_id)) {
285  $this->ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $this->ilErr->WARNING);
286  }
287  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkRoleAssignmentInput()

ilLDAPSettingsGUI::checkRoleAssignmentInput ( int  $a_rule_id = 0)
private

Check role assignment input.

Definition at line 602 of file class.ilLDAPSettingsGUI.php.

References loadRoleAssignmentRule().

Referenced by addRoleAssignment(), and updateRoleAssignment().

602  : string
603  {
604  $this->loadRoleAssignmentRule($a_rule_id);
605  $this->rule->validate();
606  return $this->ilErr->getMessage();
607  }
loadRoleAssignmentRule(int $a_rule_id, bool $load_from_form=true)
Load input from form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chooseMapping()

ilLDAPSettingsGUI::chooseMapping ( )

Definition at line 711 of file class.ilLDAPSettingsGUI.php.

References ilLDAPAttributeMappingUtils\_getMappingRulesByClass(), initAttributeMapping(), and userMapping().

711  : void
712  {
713  if (!$this->mapping_template) {
714  $this->userMapping();
715  return;
716  }
717 
718  $this->initAttributeMapping();
719  $this->mapping->clearRules();
720 
721  foreach (ilLDAPAttributeMappingUtils::_getMappingRulesByClass($this->mapping_template) as $key => $value) {
722  $this->mapping->setRule($key, $value, false);
723  }
724  $this->userMapping();
725  }
static _getMappingRulesByClass(string $a_class)
Get mapping rule by objectClass.
userMapping()
Ldap User Mapping.
+ Here is the call graph for this function:

◆ confirmDeleteRoleMapping()

ilLDAPSettingsGUI::confirmDeleteRoleMapping ( )

confirm delete role mappings

Definition at line 1571 of file class.ilLDAPSettingsGUI.php.

References $id, $txt, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilLDAPAttributeMapping\read().

1571  : void
1572  {
1573  if (!$this->mappings) {
1574  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
1575  $this->ctrl->redirect($this, "roleMapping");
1576  return;
1577  }
1578 
1579  $c_gui = new ilConfirmationGUI();
1580 
1581  // set confirm/cancel commands
1582  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteRoleMapping"));
1583  $c_gui->setHeaderText($this->lng->txt("ldap_confirm_del_role_ass"));
1584  $c_gui->setCancel($this->lng->txt("cancel"), "roleMapping");
1585  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteRoleMapping");
1586 
1587  foreach ($this->mappings as $id) {
1589  $mapping->read();
1590  $txt = $this->lng->txt('obj_role') . ": " . $mapping->getRoleName() . ", ";
1591  $txt .= $this->lng->txt('ldap_group_dn') . ": " . $mapping->getDN() . ", ";
1592  $txt .= $this->lng->txt('ldap_server_short') . " " . $mapping->getURL() . ", ";
1593  $txt .= $this->lng->txt('ldap_group_member_short') . " " . $mapping->getMemberAttribute();
1594 
1595  $c_gui->addItem("mappings[]", (string) $id, $txt);
1596  }
1597  $this->tpl->setContent($c_gui->getHTML());
1598  }
ilLDAPAttributeMapping $mapping
$txt
Definition: error.php:31
read()
Read mapping settings from db.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ confirmDeleteRules()

ilLDAPSettingsGUI::confirmDeleteRules ( )

Confirm delete rules.

Exceptions
ilCtrlException

Definition at line 427 of file class.ilLDAPSettingsGUI.php.

References ilLDAPRoleAssignmentRule\_getInstanceByRuleId(), checkAccess(), ilLDAPRoleAssignmentRule\conditionToString(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), roleAssignments(), and setSubTabs().

427  : void
428  {
429  $this->checkAccess("write");
430 
431  if (!$this->rule_ids) {
432  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
433  $this->roleAssignments();
434  return;
435  }
436  $this->setSubTabs();
437  $this->tabs_gui->activateTab('role_assignments');
438 
439  $c_gui = new ilConfirmationGUI();
440 
441  // set confirm/cancel commands
442  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteRules"));
443  $c_gui->setHeaderText($this->lng->txt("ldap_confirm_del_role_ass"));
444  $c_gui->setCancel($this->lng->txt("cancel"), "roleAssignments");
445  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteRules");
446 
447  // add items to delete
448  foreach ($this->rule_ids as $rule_id) {
450  $c_gui->addItem('rule_ids[]', (string) $rule_id, $rule->conditionToString());
451  }
452  $this->tpl->setContent($c_gui->getHTML());
453  }
setSubTabs()
Set sub tabs for ldap section.
checkAccess(string $a_permission)
roleAssignments()
Edit role assignments.
static _getInstanceByRuleId(int $a_rule_id)
ilLDAPRoleAssignmentRule $rule
+ Here is the call graph for this function:

◆ confirmDeleteServerSettings()

ilLDAPSettingsGUI::confirmDeleteServerSettings ( )

Confirm delete rules.

Definition at line 1626 of file class.ilLDAPSettingsGUI.php.

References checkAccess(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and serverList().

Referenced by handleServerTableActions().

1626  : void
1627  {
1628  $this->checkAccess("write");
1629 
1630  if (!$this->ldap_server_id) {
1631  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1632  $this->serverList();
1633  return;
1634  }
1635 
1636  $c_gui = new ilConfirmationGUI();
1637 
1638  // set confirm/cancel commands
1639  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteServerSettings"));
1640  $c_gui->setHeaderText($this->lng->txt("ldap_confirm_del_server_settings"));
1641  $c_gui->setCancel($this->lng->txt("cancel"), "serverList");
1642  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteServerSettings");
1643 
1644  // add items to delete
1645  $setting = new ilLDAPServer($this->ldap_server_id);
1646  $c_gui->addItem('server_ids[]', (string) $setting->getServerId(), $setting->getName());
1647 
1648  $this->tpl->setContent($c_gui->getHTML());
1649  }
checkAccess(string $a_permission)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createRoleMapping()

ilLDAPSettingsGUI::createRoleMapping ( )

Check add screen input and save to db.

Definition at line 1540 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\ctrl(), initRoleMappingForm(), ILIAS\Repository\lng(), ilLDAPAttributeMapping\save(), and ILIAS\UI\examples\Progress\Bar\server().

1540  : void
1541  {
1542  $propertie_form = $this->initRoleMappingForm("createRoleMapping");
1543 
1544  if ($propertie_form->checkInput() && $this->rbacReview->roleExists($propertie_form->getInput("role"))) {
1546  $mapping->setServerId($this->server->getServerId());
1547  $mapping->setURL($propertie_form->getInput("url"));
1548  $mapping->setDN($propertie_form->getInput("dn"));
1549  $mapping->setMemberAttribute($propertie_form->getInput("member"));
1550  $mapping->setMemberISDN((bool) $propertie_form->getInput("memberisdn"));
1551  $mapping->setRoleByName($propertie_form->getInput("role"));
1552  $mapping->setMappingInfo($propertie_form->getInput("info"));
1553  $mapping->setMappingInfoType((bool) $propertie_form->getInput("info_type"));
1554  $mapping->save();
1555 
1556  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1557  $this->ctrl->redirect($this, "roleMapping");
1558  } else {
1559  if (!$this->rbacReview->roleExists($propertie_form->getInput("role"))) {
1560  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("ldap_role_not_exists") . " " .
1561  $propertie_form->getInput("role"));
1562  }
1563  $propertie_form->setValuesByPost();
1564  $this->tpl->setContent($propertie_form->getHTML());
1565  }
1566  }
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
ilLDAPAttributeMapping $mapping
save()
Save mapping rules to db.
initRoleMappingForm(string $command)
init propertyformgui for Assignment of LDAP Attributes to ILIAS User Profile
+ Here is the call graph for this function:

◆ deactivateServer()

ilLDAPSettingsGUI::deactivateServer ( )

Definition at line 1697 of file class.ilLDAPSettingsGUI.php.

References checkAccess(), ILIAS\UI\examples\Progress\Bar\server(), and serverList().

Referenced by handleServerTableActions().

1697  : void
1698  {
1699  $this->checkAccess("write");
1700 
1701  $this->server->toggleActive(false);
1702  $this->server->update();
1703  $this->serverList();
1704  }
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
checkAccess(string $a_permission)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteRoleMapping()

ilLDAPSettingsGUI::deleteRoleMapping ( )

Definition at line 693 of file class.ilLDAPSettingsGUI.php.

References initRoleMapping(), ILIAS\Repository\lng(), and roleMapping().

693  : bool
694  {
695  if (!$this->mappings) {
696  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
697  $this->roleMapping();
698  return false;
699  }
700 
701  $this->initRoleMapping();
702 
703  foreach ($this->mappings as $mapping_id) {
704  $this->role_mapping->delete($mapping_id);
705  }
706  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('ldap_deleted_role_mapping'));
707  $this->roleMapping();
708  return true;
709  }
roleMapping()
Role Mapping Tab.
+ Here is the call graph for this function:

◆ deleteRules()

ilLDAPSettingsGUI::deleteRules ( )

delete role assignment rule

Definition at line 458 of file class.ilLDAPSettingsGUI.php.

References ilLDAPRoleAssignmentRule\_getInstanceByRuleId(), ILIAS\Repository\ctrl(), ilLDAPRoleAssignmentRule\delete(), ILIAS\Repository\lng(), and roleAssignments().

458  : void
459  {
460  if (!$this->rule_ids) {
461  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('select_once'));
462  $this->roleAssignments();
463  return;
464  }
465  foreach ($this->rule_ids as $rule_id) {
467  $rule->delete();
468  }
469  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('ldap_deleted_rule'));
470  $this->ctrl->redirect($this, 'roleAssignments');
471  }
roleAssignments()
Edit role assignments.
static _getInstanceByRuleId(int $a_rule_id)
ilLDAPRoleAssignmentRule $rule
+ Here is the call graph for this function:

◆ deleteServerSettings()

ilLDAPSettingsGUI::deleteServerSettings ( )

Definition at line 1654 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and serverList().

1654  : void
1655  {
1656  if (!$this->server_ids) {
1657  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1658  $this->serverList();
1659  return;
1660  }
1661 
1662  foreach ($this->server_ids as $server_id) {
1663  $setting = new ilLDAPServer($server_id);
1664  $setting->delete();
1665  }
1666  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('deleted'));
1667  $this->ctrl->redirect($this, "serverlist");
1668  }
+ Here is the call graph for this function:

◆ editRoleAssignment()

ilLDAPSettingsGUI::editRoleAssignment ( )

Edit role assignment.

Exceptions
ilCtrlException

Definition at line 338 of file class.ilLDAPSettingsGUI.php.

References ilLDAPRoleAssignmentRule\_getInstanceByRuleId(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), initFormRoleAssignments(), ILIAS\Repository\lng(), roleAssignments(), setSubTabs(), and setValuesByArray().

338  : void
339  {
340  if (!$this->rule_id) {
341  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
342  $this->roleAssignments();
343  return;
344  }
345  $this->setSubTabs();
346  $this->tabs_gui->activateTab('role_assignments');
347 
348  $this->ctrl->setParameter($this, 'rule_id', $this->rule_id);
350  'edit'
351  );
352  $this->role_mapping_rule = ilLDAPRoleAssignmentRule::_getInstanceByRuleId($this->rule_id);
353  $this->setValuesByArray();
354  $this->tpl->setContent($this->form->getHTML());
355  }
initFormRoleAssignments(string $a_mode)
Init form table for new role assignments.
setSubTabs()
Set sub tabs for ldap section.
setValuesByArray()
set values of form array
roleAssignments()
Edit role assignments.
static _getInstanceByRuleId(int $a_rule_id)
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ editRoleMapping()

ilLDAPSettingsGUI::editRoleMapping ( )

Edit Assigments for role mapping.

Definition at line 1503 of file class.ilLDAPSettingsGUI.php.

References initRoleMappingForm(), ILIAS\Repository\lng(), and ilLDAPAttributeMapping\read().

1503  : void
1504  {
1505  $mapping = new ilLDAPRoleGroupMappingSetting($this->mapping_id);
1506  $mapping->read();
1507 
1508  $propertie_form = $this->initRoleMappingForm("updateRoleMapping");
1509  $propertie_form->setTitle($this->lng->txt('ldap_edit_role_assignment'));
1510  if ($propertie_form->getItemByPostVar("url")) {
1511  $propertie_form->getItemByPostVar("url")->setValue($mapping->getURL());
1512  }
1513  if ($propertie_form->getItemByPostVar("dn")) {
1514  $propertie_form->getItemByPostVar("dn")->setValue($mapping->getDN());
1515  }
1516  if ($propertie_form->getItemByPostVar("member")) {
1517  $propertie_form->getItemByPostVar("member")->setValue($mapping->getMemberAttribute());
1518  }
1519  if ($propertie_form->getItemByPostVar("memberisdn")) {
1520  $propertie_form->getItemByPostVar("memberisdn")->setChecked($mapping->getMemberISDN());
1521  }
1522  if ($propertie_form->getItemByPostVar("role")) {
1523  $propertie_form->getItemByPostVar("role")->setValue($mapping->getRoleName());
1524  }
1525  if ($propertie_form->getItemByPostVar("info")) {
1526  $propertie_form->getItemByPostVar("info")->setValue($mapping->getMappingInfo());
1527  }
1528  if ($propertie_form->getItemByPostVar("info_type")) {
1529  $propertie_form->getItemByPostVar("info_type")->setChecked($mapping->getMappingInfoType());
1530  }
1531 
1532  $this->tpl->setContent($propertie_form->getHTML());
1533  }
ilLDAPAttributeMapping $mapping
read()
Read mapping settings from db.
initRoleMappingForm(string $command)
init propertyformgui for Assignment of LDAP Attributes to ILIAS User Profile
+ Here is the call graph for this function:

◆ editServerSettings()

ilLDAPSettingsGUI::editServerSettings ( )

Definition at line 1610 of file class.ilLDAPSettingsGUI.php.

References checkAccess(), initForm(), setServerFormValues(), and setSubTabs().

Referenced by handleServerTableActions().

1610  : void
1611  {
1612  $this->checkAccess("write");
1613 
1614  $this->setSubTabs();
1615  $this->tabs_gui->setTabActive('settings');
1616 
1617  $this->initForm();
1618  $this->setServerFormValues();
1619  $this->tpl->setContent($this->form_gui->getHTML());
1620  }
setSubTabs()
Set sub tabs for ldap section.
checkAccess(string $a_permission)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilLDAPSettingsGUI::executeCommand ( )
Exceptions
ilCtrlException

Definition at line 250 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

250  : bool
251  {
252  $next_class = $this->ctrl->getNextClass($this);
253  $cmd = $this->ctrl->getCmd();
254  if ($this->http->wrapper()->query()->has('ldap_role_mapping_table_action')) {
255  $cmd = $this->http->wrapper()->query()->retrieve(
256  'ldap_role_mapping_table_action',
257  $this->refinery->kindlyTo()->string()
258  );
259  }
260  if ($this->http->wrapper()->query()->has('ldap_role_assignment_table_action')) {
261  $cmd = $this->http->wrapper()->query()->retrieve(
262  'ldap_role_assignment_table_action',
263  $this->refinery->kindlyTo()->string()
264  );
265  }
266 
267  if ($cmd !== "serverList" && !$this->rbacSystem->checkAccess("visible,read", $this->ref_id)) {
268  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_write'), true);
269  $this->ctrl->redirect($this, "serverList");
270  }
271  switch ($next_class) {
272  default:
273  if (!$cmd) {
274  $cmd = "serverList";
275  }
276  $this->$cmd();
277  break;
278  }
279  return true;
280  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getAttributeMappingKeys()

ilLDAPSettingsGUI::getAttributeMappingKeys ( )
private

Get all possible attribute keys for mapping ldap attribute to ilias user attributes.

Returns
string[]

Definition at line 293 of file class.ilLDAPSettingsGUI.php.

References ilUserDefinedFields\_getInstance(), and getMappingFields().

Referenced by __construct().

293  : array
294  {
295  $keys = [];
296  foreach (array_keys($this->getMappingFields()) as $key) {
297  $keys[] = $key;
298  }
299  foreach (ilUserDefinedFields::_getInstance()->getDefinitions() as $definition) {
300  $keys[] = 'udf_' . $definition['field_id'];
301  }
302  return $keys;
303  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMappingFields()

ilLDAPSettingsGUI::getMappingFields ( )
private

Definition at line 1200 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\lng().

Referenced by getAttributeMappingKeys(), initUserMappingForm(), and saveMapping().

1200  : array
1201  {
1202  return array('gender' => $this->lng->txt('gender'),
1203  'firstname' => $this->lng->txt('firstname'),
1204  'lastname' => $this->lng->txt('lastname'),
1205  'title' => $this->lng->txt('person_title'),
1206  'institution' => $this->lng->txt('institution'),
1207  'department' => $this->lng->txt('department'),
1208  'street' => $this->lng->txt('street'),
1209  'city' => $this->lng->txt('city'),
1210  'zipcode' => $this->lng->txt('zipcode'),
1211  'country' => $this->lng->txt('country'),
1212  'phone_office' => $this->lng->txt('phone_office'),
1213  'phone_home' => $this->lng->txt('phone_home'),
1214  'phone_mobile' => $this->lng->txt('phone_mobile'),
1215  'fax' => $this->lng->txt('fax'),
1216  'email' => $this->lng->txt('email'),
1217  'second_email' => $this->lng->txt('second_email'),
1218  'hobby' => $this->lng->txt('hobby'),
1219  'matriculation' => $this->lng->txt('matriculation'));
1220  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleAssignmentTable()

ilLDAPSettingsGUI::getRoleAssignmentTable ( )
protected

Show active role assignments.

Definition at line 612 of file class.ilLDAPSettingsGUI.php.

References $lng, $ui_factory, ilLDAPRoleAssignmentRule\_getRules(), LDAPRoleAssignmentTable\getComponent(), ILIAS\FileDelivery\http(), null, and ILIAS\UI\examples\Progress\Bar\server().

612  : ?Table
613  {
614  if (count($rules = ilLDAPRoleAssignmentRule::_getRules($this->server->getServerId()))) {
615  $table = new LDAPRoleAssignmentTable(
616  $this->http->request(),
617  $this->lng,
619  new Factory(),
620  $this->server->getServerId(),
621  );
622  return $table->getComponent();
623  }
624  return null;
625  }
readonly ILIAS UI Factory $ui_factory
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
static _getRules($a_server_id)
Get all rules.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
Builds data types.
Definition: Factory.php:35
+ Here is the call graph for this function:

◆ getServer()

ilLDAPSettingsGUI::getServer ( )

Get server settings.

Definition at line 309 of file class.ilLDAPSettingsGUI.php.

References $server.

Referenced by initAttributeMapping(), initRoleMapping(), loadRoleAssignmentRule(), and roleSelectionRequired().

309  : ilLDAPServer
310  {
311  return $this->server;
312  }
+ Here is the caller graph for this function:

◆ handleServerTableActions()

ilLDAPSettingsGUI::handleServerTableActions ( )
private

Definition at line 755 of file class.ilLDAPSettingsGUI.php.

References activateServer(), confirmDeleteServerSettings(), ILIAS\Repository\ctrl(), deactivateServer(), editServerSettings(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

755  : void
756  {
757  $action = $this->http->wrapper()->query()->retrieve(
758  'ldap_servers_table_action',
759  $this->refinery->byTrying([
760  $this->refinery->kindlyTo()->string(),
761  $this->refinery->always('')
762  ])
763  );
764  match ($action) {
765  'editServerSettings' => $this->editServerSettings(),
766  'activateServer' => $this->activateServer(),
767  'deactivateServer' => $this->deactivateServer(),
768  'confirmDeleteServerSettings' => $this->confirmDeleteServerSettings(),
769  default => $this->ctrl->redirect($this, 'serverList'),
770  };
771  }
confirmDeleteServerSettings()
Confirm delete rules.
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ initAttributeMapping()

ilLDAPSettingsGUI::initAttributeMapping ( )
private

Definition at line 1171 of file class.ilLDAPSettingsGUI.php.

References ilLDAPAttributeMapping\_getInstanceByServerId(), and getServer().

Referenced by chooseMapping(), save(), saveMapping(), and userMapping().

1171  : void
1172  {
1173  $this->mapping = ilLDAPAttributeMapping::_getInstanceByServerId($this->getServer()->getServerId());
1174  }
getServer()
Get server settings.
static _getInstanceByServerId(int $a_server_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilLDAPSettingsGUI::initForm ( )
private

Definition at line 843 of file class.ilLDAPSettingsGUI.php.

References $version, ilAdministrationSettingsFormHandler\addFieldsToForm(), ilSubEnabledFormPropertyGUI\addSubItem(), ILIAS\Repository\ctrl(), ilAdministrationSettingsFormHandler\FORM_LDAP, ilAdministrationSettingsFormHandler\getSettingsGUIInstance(), ilLDAPServer\LDAP_BIND_ANONYMOUS, ilLDAPServer\LDAP_BIND_USER, ilLDAPServer\LDAP_SCOPE_ONE, ilLDAPServer\LDAP_SCOPE_SUB, ILIAS\Repository\lng(), prepareGlobalRoleSelection(), ilSelectInputGUI\setOptions(), and ilPasswordInputGUI\setSkipSyntaxCheck().

Referenced by addServerSettings(), editServerSettings(), and save().

843  : void
844  {
845  $this->form_gui = new ilPropertyFormGUI();
846  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
847  $this->form_gui->setTitle($this->lng->txt('ldap_configure'));
848 
849  $active = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_enable'), 'active');
850  $active->setValue("1");
851  $this->form_gui->addItem($active);
852 
853  $ds = new ilCheckboxInputGUI($this->lng->txt('ldap_as_ds'), 'ds');
854  $ds->setValue("1");
855  $ds->setInfo($this->lng->txt('ldap_as_ds_info'));
856  $this->form_gui->addItem($ds);
857 
858  $servername = new ilTextInputGUI($this->lng->txt('ldap_server_name'), 'server_name');
859  $servername->setRequired(true);
860  $servername->setInfo($this->lng->txt('ldap_server_name_info'));
861  $servername->setSize(32);
862  $servername->setMaxLength(32);
863  $this->form_gui->addItem($servername);
864 
865  // start Patch Name Filter
866  $namefilter = new ilTextInputGUI($this->lng->txt('ldap_username_filter'), "name_filter");//ADD LANG VAR
867  $namefilter->setInfo($this->lng->txt("ldap_username_filter_info"));
868  $namefilter->setSize(64);
869  $namefilter->setMaxLength(255);
870  $this->form_gui->addItem($namefilter);
871  // end Patch Name Filter
872 
873  $serverurl = new ilTextInputGUI($this->lng->txt('ldap_server'), 'server_url');
874  $serverurl->setRequired(true);
875  $serverurl->setInfo($this->lng->txt('ldap_server_url_info'));
876  $serverurl->setSize(64);
877  $serverurl->setMaxLength(255);
878  $this->form_gui->addItem($serverurl);
879 
880  $version = new ilSelectInputGUI($this->lng->txt('ldap_version'), 'version');
881  $version->setOptions(array(2 => 2, 3 => 3));
882  $version->setInfo($this->lng->txt('ldap_server_version_info'));
883  $this->form_gui->addItem($version);
884 
885  $basedsn = new ilTextInputGUI($this->lng->txt('basedn'), 'base_dn');
886  $basedsn->setRequired(true);
887  $basedsn->setSize(64);
888  $basedsn->setMaxLength(255);
889  $this->form_gui->addItem($basedsn);
890 
891  $referrals = new ilCheckboxInputGUI($this->lng->txt('ldap_referrals'), 'referrals');
892  $referrals->setValue("1");
893  $referrals->setInfo($this->lng->txt('ldap_referrals_info'));
894  $this->form_gui->addItem($referrals);
895 
896  $section_security = new ilFormSectionHeaderGUI();
897  $section_security->setTitle($this->lng->txt('ldap_server_security_settings'));
898  $this->form_gui->addItem($section_security);
899 
900  $tls = new ilCheckboxInputGUI($this->lng->txt('ldap_tls'), 'tls');
901  $tls->setValue("1");
902  $this->form_gui->addItem($tls);
903 
904  $binding = new ilRadioGroupInputGUI($this->lng->txt('ldap_server_binding'), 'binding_type');
905  $anonymous = new ilRadioOption($this->lng->txt('ldap_bind_anonymous'), (string) ilLDAPServer::LDAP_BIND_ANONYMOUS);
906  $binding->addOption($anonymous);
907  $user = new ilRadioOption($this->lng->txt('ldap_bind_user'), (string) ilLDAPServer::LDAP_BIND_USER);
908  $dn = new ilTextInputGUI($this->lng->txt('ldap_server_bind_dn'), 'bind_dn');
909  $dn->setSize(64);
910  $dn->setMaxLength(255);
911  $user->addSubItem($dn);
912  $pass = new ilPasswordInputGUI($this->lng->txt('ldap_server_bind_pass'), 'bind_pass');
913  $pass->setSkipSyntaxCheck(true);
914  $pass->setSize(12);
915  $pass->setMaxLength(100);
916  $user->addSubItem($pass);
917  $binding->addOption($user);
918  $this->form_gui->addItem($binding);
919 
920  $section_auth = new ilFormSectionHeaderGUI();
921  $section_auth->setTitle($this->lng->txt('ldap_authentication_settings'));
922  $this->form_gui->addItem($section_auth);
923 
924  $search_base = new ilTextInputGUI($this->lng->txt('ldap_user_dn'), 'search_base');
925  $search_base->setInfo($this->lng->txt('ldap_search_base_info'));
926  $search_base->setSize(64);
927  $search_base->setMaxLength(255);
928  $this->form_gui->addItem($search_base);
929 
930  $user_scope = new ilSelectInputGUI($this->lng->txt('ldap_user_scope'), 'user_scope');
931  $user_scope->setOptions(array(ilLDAPServer::LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'),
932  ilLDAPServer::LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
933  $user_scope->setInfo($this->lng->txt('ldap_user_scope_info'));
934  $this->form_gui->addItem($user_scope);
935 
936  $user_attribute = new ilTextInputGUI($this->lng->txt('ldap_user_attribute'), 'user_attribute');
937  $user_attribute->setSize(16);
938  $user_attribute->setMaxLength(64);
939  $user_attribute->setRequired(true);
940  $this->form_gui->addItem($user_attribute);
941 
942  $filter = new ilTextInputGUI($this->lng->txt('ldap_search_filter'), 'filter');
943  $filter->setInfo($this->lng->txt('ldap_filter_info'));
944  $filter->setSize(64);
945  $filter->setMaxLength(512);
946  $this->form_gui->addItem($filter);
947 
948  $section_restrictions = new ilFormSectionHeaderGUI();
949  $section_restrictions->setTitle($this->lng->txt('ldap_group_restrictions'));
950  $this->form_gui->addItem($section_restrictions);
951 
952  $group_dn = new ilTextInputGUI($this->lng->txt('ldap_group_search_base'), 'group_dn');
953  $group_dn->setInfo($this->lng->txt('ldap_group_dn_info'));
954  $group_dn->setSize(64);
955  $group_dn->setMaxLength(255);
956  $this->form_gui->addItem($group_dn);
957 
958  $group_scope = new ilSelectInputGUI($this->lng->txt('ldap_group_scope'), 'group_scope');
959  $group_scope->setOptions(array(ilLDAPServer::LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'),
960  ilLDAPServer::LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
961  $group_scope->setInfo($this->lng->txt('ldap_group_scope_info'));
962  $this->form_gui->addItem($group_scope);
963 
964  $group_filter = new ilTextInputGUI($this->lng->txt('ldap_group_filter'), 'group_filter');
965  $group_filter->setInfo($this->lng->txt('ldap_group_filter_info'));
966  $group_filter->setSize(64);
967  $group_filter->setMaxLength(255);
968  $this->form_gui->addItem($group_filter);
969 
970  $group_member = new ilTextInputGUI($this->lng->txt('ldap_group_member'), 'group_member');
971  $group_member->setInfo($this->lng->txt('ldap_group_member_info'));
972  $group_member->setSize(32);
973  $group_member->setMaxLength(255);
974  $this->form_gui->addItem($group_member);
975 
976 
977  $group_member_isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_memberisdn'), 'memberisdn');
978  #$group_member_isdn->setInfo($this->lng->txt('ldap_group_member_info'));
979  $this->form_gui->addItem($group_member_isdn);
980  #$group_member->addSubItem($group_member_isdn);
981 
982  $escapedn = new ilCheckboxInputGUI($this->lng->txt('ldap_escapedn'), 'escape_dn');
983  $escapedn->setValue("1");
984  $escapedn->setInfo($this->lng->txt('ldap_escapedn_info'));
985  $this->form_gui->addItem($escapedn);
986 
987  $group = new ilTextInputGUI($this->lng->txt('ldap_group_name'), 'group');
988  $group->setInfo($this->lng->txt('ldap_group_name_info'));
989  $group->setSize(32);
990  $group->setMaxLength(255);
991  $this->form_gui->addItem($group);
992 
993  $group_atrr = new ilTextInputGUI($this->lng->txt('ldap_group_attribute'), 'group_attribute');
994  $group_atrr->setInfo($this->lng->txt('ldap_group_attribute_info'));
995  $group_atrr->setSize(16);
996  $group_atrr->setMaxLength(64);
997  $this->form_gui->addItem($group_atrr);
998 
999  $group_optional = new ilCheckboxInputGUI($this->lng->txt('ldap_group_membership'), 'group_optional');
1000  $group_optional->setOptionTitle($this->lng->txt('ldap_group_member_optional'));
1001  $group_optional->setInfo($this->lng->txt('ldap_group_optional_info'));
1002  $group_optional->setValue("1");
1003  $group_user_filter = new ilTextInputGUI($this->lng->txt('ldap_group_user_filter'), 'group_user_filter');
1004  $group_user_filter->setSize(64);
1005  $group_user_filter->setMaxLength(255);
1006  $group_optional->addSubItem($group_user_filter);
1007  $this->form_gui->addItem($group_optional);
1008 
1009  $section_sync = new ilFormSectionHeaderGUI();
1010  $section_sync->setTitle($this->lng->txt('ldap_user_sync'));
1011  $this->form_gui->addItem($section_sync);
1012 
1013  $ci_gui = new ilCustomInputGUI($this->lng->txt('ldap_moment_sync'));
1014  $sync_on_login = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_login'), 'sync_on_login');
1015  $sync_on_login->setValue("1");
1016  $ci_gui->addSubItem($sync_on_login);
1017  $sync_per_cron = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_cron'), 'sync_per_cron');
1018  $sync_per_cron->setValue("1");
1019  $ci_gui->addSubItem($sync_per_cron);
1020  $ci_gui->setInfo($this->lng->txt('ldap_user_sync_info'));
1021  $this->form_gui->addItem($ci_gui);
1022 
1023  $global_role = new ilSelectInputGUI($this->lng->txt('ldap_global_role_assignment'), 'global_role');
1024  $global_role->setOptions($this->prepareGlobalRoleSelection());
1025  $global_role->setInfo($this->lng->txt('ldap_global_role_info'));
1026  $this->form_gui->addItem($global_role);
1027 
1028  $migr = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_migration'), 'migration');
1029  $migr->setInfo($this->lng->txt('auth_ldap_migration_info'));
1030  $migr->setValue("1");
1031  $this->form_gui->addItem($migr);
1032 
1035  $this->form_gui,
1037  );
1038 
1039  $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
1040  if ($this->ctrl->getCmd() === "addServerSettings") {
1041  $this->form_gui->addCommandButton('serverList', $this->lng->txt('cancel'));
1042  }
1043  }
This class represents an option in a radio group.
$version
Definition: plugin.php:24
This class represents a selection list property in a property form.
prepareGlobalRoleSelection()
New implementation for InputForm.
setOptions(array $a_options)
This class represents a property in a property form.
This class represents a password property in a property form.
static addFieldsToForm(int $a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormRoleAssignments()

ilLDAPSettingsGUI::initFormRoleAssignments ( string  $a_mode)
protected

Init form table for new role assignments.

Parameters
stringmode edit | create

Definition at line 1248 of file class.ilLDAPSettingsGUI.php.

References $id, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\Repository\lng(), prepareGlobalRoleSelection(), ilRadioOption\setInfo(), ilFormPropertyGUI\setRequired(), ilLDAPRoleAssignmentRule\TYPE_ATTRIBUTE, and ilLDAPRoleAssignmentRule\TYPE_GROUP.

Referenced by addRoleAssignment(), editRoleAssignment(), roleAssignments(), and updateRoleAssignment().

1248  : void
1249  {
1250  $this->form = new ilPropertyFormGUI();
1251  $this->form->setFormAction($this->ctrl->getFormAction($this));
1252 
1253  switch ($a_mode) {
1254  case 'edit':
1255  $this->form->setTitle($this->lng->txt('ldap_edit_role_ass_rule'));
1256  $this->form->addCommandButton('updateRoleAssignment', $this->lng->txt('save'));
1257  //$this->form->addCommandButton('roleAssignments',$this->lng->txt('cancel'));
1258  break;
1259  case 'create':
1260  $this->form->setTitle($this->lng->txt('ldap_add_role_ass_rule'));
1261  $this->form->addCommandButton('addRoleAssignment', $this->lng->txt('ldap_btn_add_role_ass'));
1262  //$this->form->addCommandButton('roleAssignments',$this->lng->txt('cancel'));
1263  break;
1264  }
1265 
1266  // Role Selection
1267  $role = new ilRadioGroupInputGUI($this->lng->txt('ldap_ilias_role'), 'role_name');
1268  $role->setRequired(true);
1269 
1270  $global = new ilRadioOption($this->lng->txt('ldap_global_role'), "0");
1271 
1272  $role->addOption($global);
1273 
1274  $role_select = new ilSelectInputGUI('', 'role_id');
1275  $role_select->setOptions($this->prepareGlobalRoleSelection());
1276  $global->addSubItem($role_select);
1277 
1278  $local = new ilRadioOption($this->lng->txt('ldap_local_role'), "1");
1279 
1280  $role->addOption($local);
1281 
1282  $role_search = new ilRoleAutoCompleteInputGUI('', 'role_search', $this, 'addRoleAutoCompleteObject');
1283  $role_search->setSize(40);
1284  $local->addSubItem($role_search);
1285 
1286  $role->setInfo($this->lng->txt('ldap_role_name_info'));
1287  $this->form->addItem($role);
1288 
1289  // Update options
1290  $update = new ilNonEditableValueGUI($this->lng->txt('ldap_update_roles'), 'update_roles');
1291  $update->setValue($this->lng->txt('ldap_check_role_assignment'));
1292 
1293  $add = new ilCheckboxInputGUI('', 'add_missing');
1294  $add->setOptionTitle($this->lng->txt('ldap_add_missing'));
1295  $update->addSubItem($add);
1296 
1297  $remove = new ilCheckboxInputGUI('', 'remove_deprecated');
1298  $remove->setOptionTitle($this->lng->txt('ldap_remove_deprecated'));
1299  $update->addSubItem($remove);
1300 
1301  $this->form->addItem($update);
1302 
1303 
1304 
1305  // Assignment Type
1306  $group = new ilRadioGroupInputGUI($this->lng->txt('ldap_assignment_type'), 'type');
1307  #$group->setValue($current_rule->getType());
1308  $group->setRequired(true);
1309 
1310  // Option by group
1311  $radio_group = new ilRadioOption($this->lng->txt('ldap_role_by_group'), (string) ilLDAPRoleAssignmentRule::TYPE_GROUP);
1312 
1313  $dn = new ilTextInputGUI($this->lng->txt('ldap_group_dn'), 'dn');
1314  #$dn->setValue($current_rule->getDN());
1315  $dn->setSize(32);
1316  $dn->setMaxLength(512);
1317  $dn->setInfo($this->lng->txt('ldap_role_grp_dn_info'));
1318  $radio_group->addSubItem($dn);
1319  $at = new ilTextInputGUI($this->lng->txt('ldap_role_grp_at'), 'at');
1320  #$at->setValue($current_rule->getMemberAttribute());
1321  $at->setSize(16);
1322  $at->setMaxLength(128);
1323  $radio_group->addSubItem($at);
1324  $isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_role_grp_isdn'), 'isdn');
1325  #$isdn->setChecked($current_rule->isMemberAttributeDN());
1326  $isdn->setInfo($this->lng->txt('ldap_group_member_info'));
1327  $radio_group->addSubItem($isdn);
1328  $radio_group->setInfo($this->lng->txt('ldap_role_grp_info'));
1329 
1330  $group->addOption($radio_group);
1331 
1332  // Option by Attribute
1333  $radio_attribute = new ilRadioOption($this->lng->txt('ldap_role_by_attribute'), (string) ilLDAPRoleAssignmentRule::TYPE_ATTRIBUTE);
1334  $name = new ilTextInputGUI($this->lng->txt('ldap_role_at_name'), 'name');
1335  #$name->setValue($current_rule->getAttributeName());
1336  $name->setSize(32);
1337  $name->setMaxLength(128);
1338  #$name->setInfo($this->lng->txt('ldap_role_at_name_info'));
1339  $radio_attribute->addSubItem($name);
1340 
1341  // Radio Attribute
1342  $val = new ilTextInputGUI($this->lng->txt('ldap_role_at_value'), 'value');
1343  #$val->setValue($current_rule->getAttributeValue());
1344  $val->setSize(32);
1345  $val->setMaxLength(128);
1346  #$val->setInfo($this->lng->txt('ldap_role_at_value_info'));
1347  $radio_attribute->addSubItem($val);
1348  $radio_attribute->setInfo($this->lng->txt('ldap_role_at_info'));
1349 
1350  $group->addOption($radio_attribute);
1351 
1352  // Option by Plugin
1353  $pl_active = $this->component_repository->getPluginSlotById("ldaphk")->hasActivePlugins();
1354  $pl = new ilRadioOption($this->lng->txt('ldap_plugin'), "3");
1355 
1356  $pl->setInfo($this->lng->txt('ldap_plugin_info'));
1357  $pl->setDisabled(!$pl_active);
1358 
1359  $id = new ilNumberInputGUI($this->lng->txt('ldap_plugin_id'), 'plugin_id');
1360  $id->setDisabled(!$pl_active);
1361  $id->setSize(3);
1362  $id->setMaxLength(3);
1363  $id->setMaxValue(999);
1364  $id->setMinValue(1);
1365  $pl->addSubItem($id);
1366 
1367  $group->addOption($pl);
1368  $this->form->addItem($group);
1369  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
setInfo(string $a_info)
prepareGlobalRoleSelection()
New implementation for InputForm.
This class represents a property in a property form.
This class represents a number property in a property form.
setRequired(bool $a_required)
This class represents a role + autocomplete feature form input.
form( $class_path, string $cmd, string $submit_caption="")
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRoleMapping()

ilLDAPSettingsGUI::initRoleMapping ( )
private

Definition at line 1176 of file class.ilLDAPSettingsGUI.php.

References ilLDAPRoleGroupMappingSettings\_getInstanceByServerId(), and getServer().

Referenced by deleteRoleMapping().

1176  : void
1177  {
1178  $this->role_mapping = ilLDAPRoleGroupMappingSettings::_getInstanceByServerId($this->getServer()->getServerId());
1179  }
getServer()
Get server settings.
static _getInstanceByServerId(int $a_server_id)
Get instance of class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRoleMappingForm()

ilLDAPSettingsGUI::initRoleMappingForm ( string  $command)
private

init propertyformgui for Assignment of LDAP Attributes to ILIAS User Profile

Parameters
string$commandcommand methode

Definition at line 1713 of file class.ilLDAPSettingsGUI.php.

References $info, $url, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and setSubTabs().

Referenced by addRoleMapping(), createRoleMapping(), editRoleMapping(), and updateRoleMapping().

1714  {
1715  $this->setSubTabs();
1716  $this->tabs_gui->activateTab('role_mapping');
1717 
1718  if ($this->mapping_id) {
1719  $this->ctrl->setParameter($this, 'mapping_id', $this->mapping_id);
1720  }
1721 
1722  $propertie_form = new ilPropertyFormGUI();
1723  $propertie_form->setTitle($this->lng->txt('ldap_mapping_table'));
1724  $propertie_form->setFormAction($this->ctrl->getFormAction($this, $command));
1725  $propertie_form->addCommandButton($command, $this->lng->txt('save'));
1726  $propertie_form->addCommandButton("roleMapping", $this->lng->txt('cancel'));
1727 
1728  $url = new ilTextInputGUI($this->lng->txt('ldap_server'));
1729  $url->setPostVar("url");
1730  $url->setSize(50);
1731  $url->setMaxLength(255);
1732  $url->setRequired(true);
1733 
1734  $group_dn = new ilTextInputGUI($this->lng->txt('ldap_group_dn'));
1735  $group_dn->setPostVar("dn");
1736  $group_dn->setSize(50);
1737  $group_dn->setMaxLength(255);
1738  $group_dn->setInfo($this->lng->txt('ldap_dn_info'));
1739  $group_dn->setRequired(true);
1740 
1741  $member = new ilTextInputGUI($this->lng->txt('ldap_group_member'));
1742  $member->setPostVar("member");
1743  $member->setSize(32);
1744  $member->setMaxLength(255);
1745  $member->setInfo($this->lng->txt('ldap_member_info'));
1746  $member->setRequired(true);
1747 
1748  $member_isdn = new ilCheckboxInputGUI("");
1749  $member_isdn->setPostVar("memberisdn");
1750  $member_isdn->setOptionTitle($this->lng->txt('ldap_memberisdn'));
1751 
1752  $role = new ilTextInputGUI($this->lng->txt('ldap_ilias_role'));
1753  $role->setPostVar("role");
1754  $role->setSize(32);
1755  $role->setMaxLength(255);
1756  $role->setInfo($this->lng->txt('ldap_role_info'));
1757  $role->setRequired(true);
1758 
1759  $info = new ilTextAreaInputGUI($this->lng->txt('ldap_info_text'));
1760  $info->setPostVar("info");
1761  $info->setCols(50);
1762  $info->setRows(3);
1763  $info->setInfo($this->lng->txt('ldap_info_text_info'));
1764 
1765  $info_type = new ilCheckboxInputGUI("");
1766  $info_type->setPostVar("info_type");
1767  $info_type->setOptionTitle($this->lng->txt('ldap_mapping_info_type'));
1768 
1769  $propertie_form->addItem($url);
1770  $propertie_form->addItem($group_dn);
1771  $propertie_form->addItem($member);
1772  $propertie_form->addItem($member_isdn);
1773  $propertie_form->addItem($role);
1774  $propertie_form->addItem($info);
1775  $propertie_form->addItem($info_type);
1776 
1777  return $propertie_form;
1778  }
setSubTabs()
Set sub tabs for ldap section.
$url
Definition: shib_logout.php:68
This class represents a text area property in a property form.
$info
Definition: entry_point.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initServer()

ilLDAPSettingsGUI::initServer ( )
private

Definition at line 1160 of file class.ilLDAPSettingsGUI.php.

References $ldap_server_id, and ILIAS\UI\examples\Progress\Bar\server().

Referenced by __construct().

1160  : void
1161  {
1162  $server_id = 0;
1163  if ($this->ldap_server_id) {
1164  $server_id = $this->ldap_server_id;
1165  }
1166 
1167 
1168  $this->server = new ilLDAPServer($server_id);
1169  }
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUserDefinedFields()

ilLDAPSettingsGUI::initUserDefinedFields ( )
private

Definition at line 1222 of file class.ilLDAPSettingsGUI.php.

References ilUserDefinedFields\_getInstance().

Referenced by initUserMappingForm(), and saveMapping().

1222  : void
1223  {
1224  $this->udf = ilUserDefinedFields::_getInstance();
1225  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUserMappingForm()

ilLDAPSettingsGUI::initUserMappingForm ( )
private

Create Property Form GUI for User Mapping.

Definition at line 1404 of file class.ilLDAPSettingsGUI.php.

References $lang, ILIAS\Repository\ctrl(), getMappingFields(), initUserDefinedFields(), and ILIAS\Repository\lng().

Referenced by userMapping().

1405  {
1406  $propertie_form = new ilPropertyFormGUI();
1407  $propertie_form->setTitle($this->lng->txt('ldap_mapping_table'));
1408  $propertie_form->setFormAction($this->ctrl->getFormAction($this, 'saveMapping'));
1409  $propertie_form->addCommandButton('saveMapping', $this->lng->txt('save'));
1410 
1411  foreach ($this->getMappingFields() as $mapping => $lang) {
1412  $text_form = new ilTextInputGUI($lang);
1413  $text_form->setPostVar($mapping . "_value");
1414  $text_form->setValue($this->mapping->getValue($mapping));
1415  $text_form->setSize(32);
1416  $text_form->setMaxLength(255);
1417  $propertie_form->addItem($text_form);
1418 
1419  $checkbox_form = new ilCheckboxInputGUI("");
1420  $checkbox_form->setPostVar($mapping . "_update");
1421  $checkbox_form->setChecked($this->mapping->enabledUpdate($mapping));
1422  $checkbox_form->setOptionTitle($this->lng->txt('ldap_update_field_info'));
1423  $propertie_form->addItem($checkbox_form);
1424  }
1425 
1426  $this->initUserDefinedFields();
1427  foreach ($this->udf->getDefinitions() as $definition) {
1428  $text_form = new ilTextInputGUI($definition['field_name']);
1429  $text_form->setPostVar('udf_' . $definition['field_id'] . '_value');
1430  $text_form->setValue($this->mapping->getValue('udf_' . $definition['field_id']));
1431  $text_form->setSize(32);
1432  $text_form->setMaxLength(255);
1433  $propertie_form->addItem($text_form);
1434 
1435  $checkbox_form = new ilCheckboxInputGUI("");
1436  $checkbox_form->setPostVar('udf_' . $definition['field_id'] . '_update');
1437  $checkbox_form->setChecked($this->mapping->enabledUpdate('udf_' . $definition['field_id']));
1438  $checkbox_form->setOptionTitle($this->lng->txt('ldap_update_field_info'));
1439  $propertie_form->addItem($checkbox_form);
1440  }
1441 
1442  return $propertie_form;
1443  }
ilLDAPAttributeMapping $mapping
$lang
Definition: xapiexit.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRoleAssignmentRule()

ilLDAPSettingsGUI::loadRoleAssignmentRule ( int  $a_rule_id,
bool  $load_from_form = true 
)
private

Load input from form.

Definition at line 631 of file class.ilLDAPSettingsGUI.php.

References $res, ilLDAPRoleAssignmentRule\_getInstanceByRuleId(), ILIAS\Repository\form(), ilSession\get(), getServer(), ilQueryParser\QP_COMBINATION_AND, ilQueryParser\setMinWordLength(), ilUtil\stripSlashes(), and ilLDAPRoleAssignmentRule\TYPE_ATTRIBUTE.

Referenced by checkRoleAssignmentInput(), and saveRoleSelection().

631  : void
632  {
633  if (is_object($this->rule)) {
634  return;
635  }
636 
637  $this->rule = ilLDAPRoleAssignmentRule::_getInstanceByRuleId($a_rule_id);
638 
639  if ($load_from_form) {
640  if ($this->form->getInput('role_name') === '0') {
641  $this->rule->setRoleId((int) $this->form->getInput('role_id'));
642  } elseif ($this->form->getInput('role_search')) {
643  $parser = new ilQueryParser('"' . $this->form->getInput('role_search') . '"');
644 
645  // TODO: Handle minWordLength
646  $parser->setMinWordLength(1);
647  $parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
648  $parser->parse();
649 
650  $object_search = new ilLikeObjectSearch($parser);
651  $object_search->setFilter(array('role'));
652  $res = $object_search->performSearch();
653 
654  $entries = $res->getEntries();
655  if (count($entries) === 1) {
656  $role = current($entries);
657  $this->rule->setRoleId($role['obj_id']);
658  } elseif (count($entries) > 1) {
659  $this->rule->setRoleId(-1);
660  }
661  }
662 
663  $this->rule->setAttributeName($this->form->getInput('name'));
664  $this->rule->setAttributeValue($this->form->getInput('value'));
665  $this->rule->setDN($this->form->getInput('dn'));
666  $this->rule->setMemberAttribute($this->form->getInput('at'));
667  $this->rule->setMemberIsDN((bool) $this->form->getInput('isdn'));
668  $this->rule->enableAddOnUpdate((bool) $this->form->getInput('add_missing'));
669  $this->rule->enableRemoveOnUpdate((bool) $this->form->getInput('remove_deprecated'));
670  $this->rule->setPluginId((int) $this->form->getInput('plugin_id'));
671  $this->rule->setType((int) $this->form->getInput('type'));
672  $this->rule->setServerId($this->getServer()->getServerId());
673  return;
674  }
675 
676  // LOAD from session
677  $this->rule->setServerId($this->getServer()->getServerId());
678  $rule = unserialize(ilSession::get('ldap_role_ass'), ["allowed_classes" => false]);
679 
680  $this->rule->enableAddOnUpdate((bool) ($rule['add_on_update'] ?? false));
681  $this->rule->enableRemoveOnUpdate((bool) ($rule['remove_on_update'] ?? false));
682  $this->rule->setType((int) ilUtil::stripSlashes(
684  ));
685  $this->rule->setDN(ilUtil::stripSlashes($rule['dn'] ?? ''));
686  $this->rule->setMemberAttribute(ilUtil::stripSlashes($rule['at'] ?? ''));
687  $this->rule->setMemberIsDN((bool) (ilUtil::stripSlashes($rule['isdn'] ?? false)));
688  $this->rule->setAttributeName(ilUtil::stripSlashes($rule['name'] ?? ''));
689  $this->rule->setAttributeValue(ilUtil::stripSlashes($rule['value'] ?? ''));
690  $this->rule->setPluginId((int) ilUtil::stripSlashes((string) ($rule['plugin'] ?? '0')));
691  }
static get(string $a_var)
$res
Definition: ltiservices.php:66
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
getServer()
Get server settings.
setMinWordLength(int $a_length)
static _getInstanceByRuleId(int $a_rule_id)
form( $class_path, string $cmd, string $submit_caption="")
ilLDAPRoleAssignmentRule $rule
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareGlobalRoleSelection()

ilLDAPSettingsGUI::prepareGlobalRoleSelection ( )
private

New implementation for InputForm.

Definition at line 1184 of file class.ilLDAPSettingsGUI.php.

References $role_id, ilObject\_lookupTitle(), ilUtil\_sortIds(), and ILIAS\Repository\lng().

Referenced by initForm(), and initFormRoleAssignments().

1184  : array
1185  {
1186  $global_roles = ilUtil::_sortIds(
1187  $this->rbacReview->getGlobalRoles(),
1188  'object_data',
1189  'title',
1190  'obj_id'
1191  );
1192 
1193  $select[0] = $this->lng->txt('links_select_one');
1194  foreach ($global_roles as $role_id) {
1195  $select[$role_id] = ilObject::_lookupTitle((int) $role_id);
1196  }
1197  return $select;
1198  }
static _lookupTitle(int $obj_id)
static _sortIds(array $a_ids, string $a_table, string $a_field, string $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareMappingSelect()

ilLDAPSettingsGUI::prepareMappingSelect ( )
private

Definition at line 1227 of file class.ilLDAPSettingsGUI.php.

References ilLegacyFormElementsUtil\formSelect(), and ILIAS\Repository\lng().

1227  : string
1228  {
1230  $this->mapping_template,
1231  'mapping_template',
1232  [0 => $this->lng->txt('ldap_mapping_template'),
1233  "inetOrgPerson" => 'inetOrgPerson',
1234  "organizationalPerson" => 'organizationalPerson',
1235  "person" => 'person',
1236  "ad_2003" => 'Active Directory (Win 2003)'
1237  ],
1238  false,
1239  true
1240  );
1241  }
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
+ Here is the call graph for this function:

◆ roleAssignments()

ilLDAPSettingsGUI::roleAssignments ( )

Edit role assignments.

Definition at line 317 of file class.ilLDAPSettingsGUI.php.

References ilLDAPRoleAssignmentRule\_getInstanceByRuleId(), ilLDAPRoleAssignmentRule\_getRules(), ILIAS\Repository\form(), initFormRoleAssignments(), ILIAS\UI\examples\Progress\Bar\server(), and setSubTabs().

Referenced by addRoleAssignment(), confirmDeleteRules(), deleteRules(), editRoleAssignment(), saveRoleSelection(), and updateRoleAssignment().

317  : void
318  {
319  $this->setSubTabs();
320  $this->tabs_gui->activateTab('role_assignments');
321 
322  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_assignments.html', 'components/ILIAS/LDAP');
323 
324  $this->initFormRoleAssignments('create');
325  $this->role_mapping_rule = ilLDAPRoleAssignmentRule::_getInstanceByRuleId(0);
326  $this->tpl->setVariable('NEW_ASSIGNMENT_TBL', $this->form->getHTML());
327 
328 
329  if (count($rules = ilLDAPRoleAssignmentRule::_getRules($this->server->getServerId()))) {
330  $this->tpl->setVariable('RULES_TBL', $this->ui_renderer->render($this->getRoleAssignmentTable()));
331  }
332  }
initFormRoleAssignments(string $a_mode)
Init form table for new role assignments.
setSubTabs()
Set sub tabs for ldap section.
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
static _getRules($a_server_id)
Get all rules.
static _getInstanceByRuleId(int $a_rule_id)
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roleMapping()

ilLDAPSettingsGUI::roleMapping ( )

Role Mapping Tab.

Definition at line 1448 of file class.ilLDAPSettingsGUI.php.

References $lng, $object_data_cache, $rbacReview, $ui_factory, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\UI\examples\Progress\Bar\server(), ilFormPropertyGUI\setInfo(), setSubTabs(), and ILIAS\Repository\toolbar().

Referenced by deleteRoleMapping().

1448  : void
1449  {
1450  $this->setSubTabs();
1451  $this->tabs_gui->setTabActive('role_mapping');
1452  $this->toolbar->addButton(
1453  $this->lng->txt("ldap_new_role_assignment"),
1454  $this->ctrl->getLinkTarget($this, 'addRoleMapping')
1455  );
1456 
1457  //Set propertyform for synchronization settings
1458  $propertie_form = new ilPropertyFormGUI();
1459  $propertie_form->setTitle($this->lng->txt('ldap_role_settings'));
1460  $propertie_form->setFormAction($this->ctrl->getFormAction($this, "saveSyncronizationSettings"));
1461  $propertie_form->addCommandButton("saveSyncronizationSettings", $this->lng->txt('save'));
1462  $role_active = new ilCheckboxInputGUI($this->lng->txt('ldap_role_active'));
1463  $role_active->setPostVar('role_sync_active');
1464  $role_active->setChecked($this->server->enabledRoleSynchronization());
1465  $propertie_form->addItem($role_active);
1466  $binding = new ilCombinationInputGUI($this->lng->txt('ldap_server_binding'));
1467  $binding->setInfo($this->lng->txt('ldap_role_bind_user_info'));
1468  $user = new ilTextInputGUI("");
1469  $user->setPostVar("role_bind_user");
1470  $user->setValue($this->server->getRoleBindDN());
1471  $user->setSize(50);
1472  $user->setMaxLength(255);
1473  $binding->addCombinationItem("0", $user, $this->lng->txt('ldap_role_bind_user'));
1474 
1475  $pass = new ilPasswordInputGUI("");
1476  $pass->setPostVar("role_bind_pass");
1477  $pass->setValue($this->server->getRoleBindPassword());
1478  $pass->setSize(12);
1479  $pass->setMaxLength(100);
1480  $pass->setRetype(false);
1481  $binding->addCombinationItem("1", $pass, $this->lng->txt('ldap_role_bind_pass'));
1482 
1483  $propertie_form->addItem($binding);
1484 
1485  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_mappings.html', 'components/ILIAS/LDAP');
1486  $this->tpl->setVariable("NEW_ASSIGNMENT_TBL", $propertie_form->getHTML());
1487 
1488  $table = new LDAPRoleMappingTable(
1489  $this->http->request(),
1490  $this->lng,
1492  new Factory(),
1493  $this->server->getServerId(),
1496  );
1497  $this->tpl->setVariable('RULES_TBL', $this->ui_renderer->render($table->getComponent()));
1498  }
readonly ILIAS UI Factory $ui_factory
readonly ilObjectDataCache $object_data_cache
setSubTabs()
Set sub tabs for ldap section.
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
static http()
Fetches the global http state from ILIAS.
This class represents a password property in a property form.
Builds data types.
Definition: Factory.php:35
This class represents a number property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roleSelectionRequired()

ilLDAPSettingsGUI::roleSelectionRequired ( )
private

Definition at line 512 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), getServer(), and ilSession\set().

Referenced by addRoleAssignment(), and updateRoleAssignment().

512  : bool
513  {
514  if ($this->rule->getRoleId() > 0) {
515  return false;
516  }
517  $rule = [];
518  $rule['server_id'] = $this->getServer()->getServerId();
519  $rule['rule_id'] = $this->rule_id ?: 0;
520  $rule['role_search'] = $this->form->getInput('role_search');
521  $rule['add_on_update'] = $this->form->getInput('add_missing');
522  $rule['remove_on_update'] = $this->form->getInput('remove_deprecated');
523  $rule['type'] = $this->form->getInput('type');
524  $rule['dn'] = $this->form->getInput('dn');
525  $rule['at'] = $this->form->getInput('at');
526  $rule['isdn'] = $this->form->getInput('isdn');
527  $rule['name'] = $this->form->getInput('name');
528  $rule['value'] = $this->form->getInput('value');
529  $rule['plugin'] = $this->form->getInput('plugin_id');
530  ilSession::set("ldap_role_ass", serialize($rule));
531  $this->ctrl->saveParameter($this, 'rule_id');
532  return true;
533  }
getServer()
Get server settings.
form( $class_path, string $cmd, string $submit_caption="")
ilLDAPRoleAssignmentRule $rule
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilLDAPSettingsGUI::save ( )

Definition at line 1048 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\ctrl(), initAttributeMapping(), initForm(), ILIAS\Repository\lng(), ILIAS\UI\examples\Progress\Bar\server(), and setSubTabs().

1048  : bool
1049  {
1050  $this->setSubTabs();
1051  $this->tabs_gui->setTabActive('settings');
1052 
1053  $this->initForm();
1054  if ($this->form_gui->checkInput()) {
1055  $this->server->toggleActive((bool) $this->form_gui->getInput('active'));
1056  $this->server->enableAuthentication(!(bool) $this->form_gui->getInput('ds'));
1057  $this->server->setName($this->form_gui->getInput('server_name'));
1058  $this->server->setUrl($this->form_gui->getInput('server_url'));
1059  $this->server->setVersion((int) $this->form_gui->getInput('version'));
1060  $this->server->setBaseDN($this->form_gui->getInput('base_dn'));
1061  $this->server->toggleReferrer((bool) $this->form_gui->getInput('referrals'));
1062  $this->server->toggleTLS((bool) $this->form_gui->getInput('tls'));
1063  $this->server->setBindingType((int) $this->form_gui->getInput('binding_type'));
1064  $this->server->setBindUser($this->form_gui->getInput('bind_dn'));
1065  $this->server->setBindPassword($this->form_gui->getInput('bind_pass'));
1066  $this->server->setSearchBase($this->form_gui->getInput('search_base'));
1067  $this->server->setUserScope((int) $this->form_gui->getInput('user_scope'));
1068  $this->server->setUserAttribute($this->form_gui->getInput('user_attribute'));
1069  $this->server->setFilter($this->form_gui->getInput('filter'));
1070  $this->server->setGroupDN($this->form_gui->getInput('group_dn'));
1071  $this->server->setGroupScope((int) $this->form_gui->getInput('group_scope'));
1072  $this->server->setGroupFilter($this->form_gui->getInput('group_filter'));
1073  $this->server->setGroupMember($this->form_gui->getInput('group_member'));
1074  $this->server->enableGroupMemberIsDN((bool) $this->form_gui->getInput('memberisdn'));
1075  $this->server->setGroupName($this->form_gui->getInput('group'));
1076  $this->server->setGroupAttribute($this->form_gui->getInput('group_attribute'));
1077  $this->server->setGroupUserFilter($this->form_gui->getInput('group_user_filter'));
1078  $this->server->toggleMembershipOptional((bool) $this->form_gui->getInput('group_optional'));
1079  $this->server->enableSyncOnLogin((bool) $this->form_gui->getInput('sync_on_login'));
1080  $this->server->enableSyncPerCron((bool) $this->form_gui->getInput('sync_per_cron'));
1081  $this->server->setGlobalRole((int) $this->form_gui->getInput('global_role'));
1082  $this->server->enableAccountMigration((bool) $this->form_gui->getInput('migration'));
1083  $this->server->setUsernameFilter($this->form_gui->getInput("name_filter"));
1084  $this->server->enableEscapeDN((bool) $this->form_gui->getInput('escape_dn'));
1085  if (!$this->server->validate()) {
1086  $this->main_tpl->setOnScreenMessage('failure', $this->ilErr->getMessage());
1087  $this->form_gui->setValuesByPost();
1088  $this->tpl->setContent($this->form_gui->getHTML());
1089  return false;
1090  }
1091 
1092  // Update or create
1093  if ($this->server->getServerId()) {
1094  $this->server->update();
1095  } else {
1096  $this->server->create();
1097  }
1098 
1099  // Now server_id exists => update LDAP attribute mapping
1100  $this->initAttributeMapping();
1101  $this->mapping->setRule('global_role', (string) $this->form_gui->getInput('global_role'), false);
1102  $this->mapping->save();
1103 
1104  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1105  $this->ctrl->redirect($this, 'serverList');
1106  return true;
1107  }
1108 
1109  $this->form_gui->setValuesByPost();
1110  $this->tpl->setContent($this->form_gui->getHTML());
1111  return true;
1112  }
setSubTabs()
Set sub tabs for ldap section.
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
+ Here is the call graph for this function:

◆ saveMapping()

ilLDAPSettingsGUI::saveMapping ( )

Definition at line 727 of file class.ilLDAPSettingsGUI.php.

References getMappingFields(), initAttributeMapping(), initUserDefinedFields(), ILIAS\Repository\lng(), and userMapping().

727  : void
728  {
729  $this->initAttributeMapping();
730  $this->tabs_gui->activateTab('role_mapping');
731 
732  foreach (array_keys($this->getMappingFields()) as $key) {
733  $this->mapping->setRule(
734  $key,
735  $this->attribute_mappings[$key][0],
736  $this->attribute_mappings[$key][1]
737  );
738  }
739  $this->initUserDefinedFields();
740  foreach ($this->udf->getDefinitions() as $definition) {
741  $key = 'udf_' . $definition['field_id'];
742  $this->mapping->setRule(
743  $key,
744  $this->attribute_mappings[$key][0],
745  $this->attribute_mappings[$key][1]
746  );
747  }
748 
749  $this->mapping->save();
750  $this->userMapping();
751 
752  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
753  }
userMapping()
Ldap User Mapping.
+ Here is the call graph for this function:

◆ saveRoleSelection()

ilLDAPSettingsGUI::saveRoleSelection ( )
protected

Save role selection.

Returns

Definition at line 570 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\lng(), loadRoleAssignmentRule(), roleAssignments(), and showRoleSelection().

570  : bool
571  {
572  if (!$this->ilAccess->checkAccess('write', '', $this->ref_id)) {
573  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
574  $this->roleAssignments();
575  return false;
576  }
577 
578  if (!$this->role_id) {
579  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
580  $this->showRoleSelection();
581  return false;
582  }
583 
584  $this->loadRoleAssignmentRule($this->rule_id ?? 0, false);
585  $this->rule->setRoleId($this->role_id);
586 
587  if ($this->rule_id) {
588  $this->rule->update();
589  } else {
590  $this->rule->create();
591  }
592 
593  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
594  $this->roleAssignments();
595  return true;
596  }
loadRoleAssignmentRule(int $a_rule_id, bool $load_from_form=true)
Load input from form.
showRoleSelection()
show role selection
roleAssignments()
Edit role assignments.
+ Here is the call graph for this function:

◆ saveSyncronizationSettings()

ilLDAPSettingsGUI::saveSyncronizationSettings ( )

save Syncronization Settings on Role Mapping screen

Definition at line 1855 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\UI\examples\Progress\Bar\server().

1855  : void
1856  {
1857  $this->server->setRoleBindDN($this->role_bind_user);
1858  $this->server->setRoleBindPassword($this->role_bind_pass);
1859  $this->server->enableRoleSynchronization($this->role_sync_active);
1860 
1861  // Update or create
1862  if ($this->server->getServerId()) {
1863  $this->server->update();
1864  }
1865  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1866  $this->ctrl->redirect($this, "roleMapping");
1867  }
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
+ Here is the call graph for this function:

◆ serverList()

ilLDAPSettingsGUI::serverList ( )
private

Definition at line 773 of file class.ilLDAPSettingsGUI.php.

References ilLDAPServer\_getAllServer(), ilLDAPServer\checkLDAPLib(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\UI\examples\Progress\Bar\server(), and ILIAS\Repository\toolbar().

Referenced by activateServer(), confirmDeleteServerSettings(), deactivateServer(), and deleteServerSettings().

773  : void
774  {
775  if (!$this->rbacSystem->checkAccess('visible,read', $this->ref_id)) {
776  $this->ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $this->ilErr->WARNING);
777  }
778 
779  if (!ilLDAPServer::checkLDAPLib() && $this->server->isActive()) {
780  $this->main_tpl->setOnScreenMessage('failure', 'Missing LDAP libraries. Please ensure that the PHP LDAP module is installed on your server.');
781  }
782 
783  if ($this->rbacSystem->checkAccess('write', $this->ref_id)) {
784  $this->toolbar->addButton(
785  $this->lng->txt('add_ldap_server'),
786  $this->ctrl->getLinkTarget($this, 'addServerSettings')
787  );
788  }
789 
790  $table = new \ILIAS\LDAP\Server\UI\ServerTable(
792  $this,
793  $this->ui_factory,
794  $this->ui_renderer,
795  $this->lng,
796  $this->ctrl,
797  $this->http->request(),
798  new \ILIAS\Data\Factory(),
799  'handleServerTableActions',
800  $this->rbacSystem->checkAccess('write', $this->ref_id)
801  );
802 
803  $this->tpl->setContent($this->ui_renderer->render($table->getComponent()));
804  }
static checkLDAPLib()
Check if ldap module is installed.
static _getAllServer()
Get list of all configured servers.
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setServerFormValues()

ilLDAPSettingsGUI::setServerFormValues ( )

Definition at line 806 of file class.ilLDAPSettingsGUI.php.

References ilLDAPAttributeMapping\_lookupGlobalRole(), and ILIAS\UI\examples\Progress\Bar\server().

Referenced by editServerSettings().

806  : void
807  {
808  $this->form_gui->setValuesByArray(array(
809  'active' => $this->server->isActive(),
810  'ds' => !$this->server->isAuthenticationEnabled(),
811  'server_name' => $this->server->getName(),
812  'server_url' => $this->server->getUrlString(),
813  'version' => $this->server->getVersion(),
814  'base_dn' => $this->server->getBaseDN(),
815  'referrals' => $this->server->isActiveReferrer(),
816  'tls' => $this->server->isActiveTLS(),
817  'binding_type' => $this->server->getBindingType(),
818  'bind_dn' => $this->server->getBindUser(),
819  'bind_pass' => $this->server->getBindPassword(),
820  'bind_pass_retype' => $this->server->getBindPassword(),
821  'search_base' => $this->server->getSearchBase(),
822  'user_scope' => $this->server->getUserScope(),
823  'user_attribute' => $this->server->getUserAttribute(),
824  'filter' => $this->server->getFilter(),
825  'group_dn' => $this->server->getGroupDN(),
826  'group_scope' => $this->server->getGroupScope(),
827  'group_filter' => $this->server->getGroupFilter(),
828  'group_member' => $this->server->getGroupMember(),
829  'memberisdn' => $this->server->enabledGroupMemberIsDN(),
830  'group' => $this->server->getGroupName(),
831  'group_attribute' => $this->server->getGroupAttribute(),
832  'group_optional' => $this->server->isMembershipOptional(),
833  'group_user_filter' => $this->server->getGroupUserFilter(),
834  'sync_on_login' => $this->server->enabledSyncOnLogin(),
835  'sync_per_cron' => $this->server->enabledSyncPerCron(),
836  'global_role' => ilLDAPAttributeMapping::_lookupGlobalRole($this->server->getServerId()),
837  'migration' => (int) $this->server->isAccountMigrationEnabled(),
838  "name_filter" => $this->server->getUsernameFilter(),
839  'escape_dn' => $this->server->enabledEscapeDN()
840  ));
841  }
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
static _lookupGlobalRole(int $a_server_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabs()

ilLDAPSettingsGUI::setSubTabs ( )
private

Set sub tabs for ldap section.

Definition at line 1119 of file class.ilLDAPSettingsGUI.php.

References ilLDAPServer\_getServerList(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by addRoleAssignment(), confirmDeleteRules(), editRoleAssignment(), editServerSettings(), initRoleMappingForm(), roleAssignments(), roleMapping(), save(), showRoleSelection(), and userMapping().

1119  : void
1120  {
1121  $this->tabs_gui->clearTargets();
1122 
1123  $this->tabs_gui->setBackTarget(
1124  $this->lng->txt("back"),
1125  $this->ctrl->getLinkTarget($this, 'serverList')
1126  );
1127 
1128 
1129  $this->tabs_gui->addTab(
1130  "settings",
1131  $this->lng->txt("ldap_settings"),
1132  $this->ctrl->getLinkTarget($this, 'editServerSettings')
1133  );
1134 
1135  // Disable all other tabs, if server hasn't been configured.
1136  if (!count(ilLDAPServer::_getServerList())) {
1137  return;
1138  }
1139 
1140  $this->tabs_gui->addTab(
1141  "user_mapping",
1142  $this->lng->txt("ldap_user_mapping"),
1143  $this->ctrl->getLinkTarget($this, 'userMapping')
1144  );
1145 
1146  $this->tabs_gui->addTab(
1147  "role_assignments",
1148  $this->lng->txt('ldap_role_assignments'),
1149  $this->ctrl->getLinkTarget($this, 'roleAssignments')
1150  );
1151 
1152  $this->tabs_gui->addTab(
1153  "role_mapping",
1154  $this->lng->txt("ldap_role_mapping"),
1155  $this->ctrl->getLinkTarget($this, 'roleMapping')
1156  );
1157  }
static _getServerList()
Get list of all configured servers.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValuesByArray()

ilLDAPSettingsGUI::setValuesByArray ( )
private

set values of form array

Definition at line 361 of file class.ilLDAPSettingsGUI.php.

References $role_id, ilObject\_lookupTitle(), ILIAS\Repository\form(), and ILIAS\Repository\int().

Referenced by editRoleAssignment().

361  : void
362  {
363  $role_id = $this->role_mapping_rule->getRoleId();
364  if ($this->rbacReview->isGlobalRole($role_id)) {
365  $val['role_name'] = 0;
366  $val['role_id'] = $role_id;
367  } else {
368  $val['role_name'] = 1;
369  $val['role_search'] = ilObject::_lookupTitle($role_id);
370  }
371  $val['add_missing'] = (int) $this->role_mapping_rule->isAddOnUpdateEnabled();
372  $val['remove_deprecated'] = (int) $this->role_mapping_rule->isRemoveOnUpdateEnabled();
373  $val['type'] = $this->role_mapping_rule->getType();
374  $val['dn'] = $this->role_mapping_rule->getDN();
375  $val['at'] = $this->role_mapping_rule->getMemberAttribute();
376  $val['isdn'] = $this->role_mapping_rule->isMemberAttributeDN();
377  $val['name'] = $this->role_mapping_rule->getAttributeName();
378  $val['value'] = $this->role_mapping_rule->getAttributeValue();
379  $val['plugin_id'] = $this->role_mapping_rule->getPluginId();
380 
381  $this->form->setValuesByArray($val);
382  }
static _lookupTitle(int $obj_id)
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showRoleSelection()

ilLDAPSettingsGUI::showRoleSelection ( )
protected

show role selection

Definition at line 540 of file class.ilLDAPSettingsGUI.php.

References $res, ILIAS\Repository\ctrl(), ilSession\get(), ILIAS\Repository\lng(), ilQueryParser\QP_COMBINATION_AND, and setSubTabs().

Referenced by saveRoleSelection().

540  : bool
541  {
542  $this->setSubTabs();
543  $this->tabs_gui->activateTab('role_assignment');
544  $this->ctrl->saveParameter($this, 'rule_id');
545 
546  $parser = new ilQueryParser(unserialize(ilSession::get('ldap_role_ass'), ["allowed_classes" => false])['role_search']);
547  $parser->setMinWordLength(1);
548  $parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
549  $parser->parse();
550 
551  $object_search = new ilLikeObjectSearch($parser);
552  $object_search->setFilter(array('role'));
553  $res = $object_search->performSearch();
554 
555  $entries = $res->getEntries();
556 
557  $table = new ilRoleSelectionTableGUI($this, 'showRoleSelection');
558  $table->setTitle($this->lng->txt('ldap_role_selection'));
559  $table->addMultiCommand('saveRoleSelection', $this->lng->txt('ldap_choose_role'));
560  $table->parse($entries);
561 
562  $this->tpl->setContent($table->getHTML());
563  return true;
564  }
static get(string $a_var)
$res
Definition: ltiservices.php:66
setSubTabs()
Set sub tabs for ldap section.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateRoleAssignment()

ilLDAPSettingsGUI::updateRoleAssignment ( )

update role assignment

Definition at line 387 of file class.ilLDAPSettingsGUI.php.

References checkRoleAssignmentInput(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), initFormRoleAssignments(), ILIAS\Repository\lng(), roleAssignments(), and roleSelectionRequired().

387  : bool
388  {
389  if (!$this->ilAccess->checkAccess('write', '', $this->ref_id)) {
390  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
391  $this->roleAssignments();
392  return false;
393  }
394 
395  $this->initFormRoleAssignments('edit');
396 
397  $formWithoutErrors = $this->form->checkInput();
398  $roleErrorMessage = $this->checkRoleAssignmentInput($this->rule_id);
399  if (!$formWithoutErrors || $roleErrorMessage !== '') {
400  if ($roleErrorMessage !== '') {
401  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt($roleErrorMessage));
402  }
403 
404  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_assignments.html', 'components/ILIAS/LDAP');
405 
406  $this->form->setValuesByPost();
407  $this->tpl->setVariable('NEW_ASSIGNMENT_TBL', $this->form->getHTML());
408  $this->tabs_gui->activateSubTab('role_assignments');
409  return true;
410  }
411 
412  // Might redirect
413  if ($this->roleSelectionRequired()) {
414  $this->ctrl->redirect($this, 'showRoleSelection');
415  } else {
416  $this->rule->update();
417  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
418  $this->roleAssignments();
419  }
420  return true;
421  }
checkRoleAssignmentInput(int $a_rule_id=0)
Check role assignment input.
initFormRoleAssignments(string $a_mode)
Init form table for new role assignments.
roleAssignments()
Edit role assignments.
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ updateRoleMapping()

ilLDAPSettingsGUI::updateRoleMapping ( )

Check edit screen input and save to db.

Definition at line 1824 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\ctrl(), initRoleMappingForm(), ILIAS\Repository\lng(), and ILIAS\UI\examples\Progress\Bar\server().

1824  : void
1825  {
1826  $propertie_form = $this->initRoleMappingForm("updateRoleMapping");
1827 
1828  if ($propertie_form->checkInput() && $this->rbacReview->roleExists($propertie_form->getInput("role"))) {
1829  $mapping = new ilLDAPRoleGroupMappingSetting($this->mapping_id);
1830  $mapping->setServerId($this->server->getServerId());
1831  $mapping->setURL($propertie_form->getInput("url"));
1832  $mapping->setDN($propertie_form->getInput("dn"));
1833  $mapping->setMemberAttribute($propertie_form->getInput("member"));
1834  $mapping->setMemberISDN((bool) $propertie_form->getInput("memberisdn"));
1835  $mapping->setRoleByName($propertie_form->getInput("role"));
1836  $mapping->setMappingInfo($propertie_form->getInput("info"));
1837  $mapping->setMappingInfoType((bool) $propertie_form->getInput("info_type"));
1838  $mapping->update();
1839 
1840  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1841  $this->ctrl->redirect($this, "roleMapping");
1842  } else {
1843  if (!$this->rbacReview->roleExists($propertie_form->getInput("role"))) {
1844  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("ldap_role_not_exists") . " " .
1845  $propertie_form->getInput("role"));
1846  }
1847  $propertie_form->setValuesByPost();
1848  $this->tpl->setContent($propertie_form->getHTML());
1849  }
1850  }
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
Definition: server.php:43
ilLDAPAttributeMapping $mapping
initRoleMappingForm(string $command)
init propertyformgui for Assignment of LDAP Attributes to ILIAS User Profile
+ Here is the call graph for this function:

◆ userMapping()

ilLDAPSettingsGUI::userMapping ( )

Ldap User Mapping.

Definition at line 1673 of file class.ilLDAPSettingsGUI.php.

References initAttributeMapping(), initUserMappingForm(), setSubTabs(), and userMappingToolbar().

Referenced by chooseMapping(), and saveMapping().

1673  : void
1674  {
1675  $this->initAttributeMapping();
1676 
1677  $this->setSubTabs();
1678  $this->tabs_gui->activateTab('user_mapping');
1679  $this->userMappingToolbar();
1680 
1681  $propertie_form = $this->initUserMappingForm();
1682 
1683  $this->tpl->setContent($propertie_form->getHTML());
1684  }
userMappingToolbar()
Create Toolbar.
setSubTabs()
Set sub tabs for ldap section.
initUserMappingForm()
Create Property Form GUI for User Mapping.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userMappingToolbar()

ilLDAPSettingsGUI::userMappingToolbar ( )
private

Create Toolbar.

Definition at line 1383 of file class.ilLDAPSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by userMapping().

1383  : void
1384  {
1385  $select_form = new ilSelectInputGUI("mapping_template");
1386  $select_form->setPostVar("mapping_template");
1387  $options = array(
1388  "" => $this->lng->txt('ldap_mapping_template'),
1389  "inetOrgPerson" => 'inetOrgPerson',
1390  "organizationalPerson" => 'organizationalPerson',
1391  "person" => 'person',
1392  "ad_2003" => 'Active Directory (Win 2003)');
1393  $select_form->setOptions($options);
1394  $select_form->setValue($this->mapping_template);
1395 
1396  $this->toolbar->addInputItem($select_form);
1397  $this->toolbar->addFormButton($this->lng->txt('show'), "chooseMapping");
1398  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, "chooseMapping"));
1399  }
This class represents a selection list property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $attribute_mappings

array ilLDAPSettingsGUI::$attribute_mappings = []
private

Definition at line 66 of file class.ilLDAPSettingsGUI.php.

◆ $component_repository

ilComponentRepository ilLDAPSettingsGUI::$component_repository
private

Definition at line 45 of file class.ilLDAPSettingsGUI.php.

◆ $ctrl

ilCtrl ilLDAPSettingsGUI::$ctrl
private

Definition at line 35 of file class.ilLDAPSettingsGUI.php.

◆ $form

ilPropertyFormGUI ilLDAPSettingsGUI::$form = null
private

Definition at line 33 of file class.ilLDAPSettingsGUI.php.

◆ $form_gui

ilPropertyFormGUI ilLDAPSettingsGUI::$form_gui = null
private

Definition at line 32 of file class.ilLDAPSettingsGUI.php.

◆ $http

readonly ILIAS HTTP GlobalHttpState ilLDAPSettingsGUI::$http
private

Definition at line 69 of file class.ilLDAPSettingsGUI.php.

◆ $ilAccess

ilAccessHandler ilLDAPSettingsGUI::$ilAccess
private

Definition at line 40 of file class.ilLDAPSettingsGUI.php.

◆ $ilErr

ilErrorHandling ilLDAPSettingsGUI::$ilErr
private

Definition at line 39 of file class.ilLDAPSettingsGUI.php.

◆ $ldap_server_id

int ilLDAPSettingsGUI::$ldap_server_id = null
private

Definition at line 59 of file class.ilLDAPSettingsGUI.php.

Referenced by initServer().

◆ $lng

ilLanguage ilLDAPSettingsGUI::$lng
private

Definition at line 37 of file class.ilLDAPSettingsGUI.php.

Referenced by getRoleAssignmentTable(), and roleMapping().

◆ $main_tpl

ilGlobalTemplateInterface ilLDAPSettingsGUI::$main_tpl
private

Definition at line 44 of file class.ilLDAPSettingsGUI.php.

◆ $mapping

ilLDAPAttributeMapping ilLDAPSettingsGUI::$mapping
private

Definition at line 31 of file class.ilLDAPSettingsGUI.php.

◆ $mapping_id

int ilLDAPSettingsGUI::$mapping_id = null
private

Definition at line 62 of file class.ilLDAPSettingsGUI.php.

◆ $mapping_template

string ilLDAPSettingsGUI::$mapping_template = null
private

Definition at line 58 of file class.ilLDAPSettingsGUI.php.

◆ $mappings

array ilLDAPSettingsGUI::$mappings = null
private

Definition at line 57 of file class.ilLDAPSettingsGUI.php.

◆ $object_data_cache

readonly ilObjectDataCache ilLDAPSettingsGUI::$object_data_cache
private

Definition at line 71 of file class.ilLDAPSettingsGUI.php.

Referenced by roleMapping().

◆ $rbacReview

ilRbacReview ilLDAPSettingsGUI::$rbacReview
private

Definition at line 41 of file class.ilLDAPSettingsGUI.php.

Referenced by roleMapping().

◆ $rbacSystem

ilRbacSystem ilLDAPSettingsGUI::$rbacSystem
private

Definition at line 42 of file class.ilLDAPSettingsGUI.php.

◆ $ref_id

int ilLDAPSettingsGUI::$ref_id
private

Definition at line 29 of file class.ilLDAPSettingsGUI.php.

◆ $refinery

readonly ILIAS Refinery Factory ilLDAPSettingsGUI::$refinery
private

Definition at line 70 of file class.ilLDAPSettingsGUI.php.

◆ $role_bind_pass

string ilLDAPSettingsGUI::$role_bind_pass = null
private

Definition at line 64 of file class.ilLDAPSettingsGUI.php.

◆ $role_bind_user

string ilLDAPSettingsGUI::$role_bind_user = null
private

Definition at line 63 of file class.ilLDAPSettingsGUI.php.

◆ $role_id

int ilLDAPSettingsGUI::$role_id = null
private

Definition at line 55 of file class.ilLDAPSettingsGUI.php.

Referenced by prepareGlobalRoleSelection(), and setValuesByArray().

◆ $role_mapping

ilLDAPRoleGroupMappingSettings ilLDAPSettingsGUI::$role_mapping = null
private

Definition at line 49 of file class.ilLDAPSettingsGUI.php.

◆ $role_mapping_rule

ilLDAPRoleAssignmentRule ilLDAPSettingsGUI::$role_mapping_rule = null
private

Definition at line 47 of file class.ilLDAPSettingsGUI.php.

◆ $role_sync_active

bool ilLDAPSettingsGUI::$role_sync_active = false
private

Definition at line 65 of file class.ilLDAPSettingsGUI.php.

◆ $rule

ilLDAPRoleAssignmentRule ilLDAPSettingsGUI::$rule = null
private

Definition at line 48 of file class.ilLDAPSettingsGUI.php.

◆ $rule_id

int ilLDAPSettingsGUI::$rule_id = null
private

Definition at line 54 of file class.ilLDAPSettingsGUI.php.

◆ $rule_ids

array ilLDAPSettingsGUI::$rule_ids = null
private

Definition at line 53 of file class.ilLDAPSettingsGUI.php.

◆ $server

ilLDAPServer ilLDAPSettingsGUI::$server
private

Definition at line 30 of file class.ilLDAPSettingsGUI.php.

Referenced by getServer().

◆ $server_ids

array ilLDAPSettingsGUI::$server_ids = null
private

Definition at line 61 of file class.ilLDAPSettingsGUI.php.

◆ $tabs_gui

ilTabsGUI ilLDAPSettingsGUI::$tabs_gui
private

Definition at line 36 of file class.ilLDAPSettingsGUI.php.

◆ $toolbar

ilToolbarGUI ilLDAPSettingsGUI::$toolbar
private

Definition at line 43 of file class.ilLDAPSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilLDAPSettingsGUI::$tpl
private

Definition at line 38 of file class.ilLDAPSettingsGUI.php.

◆ $udf

ilUserDefinedFields ilLDAPSettingsGUI::$udf
private

Definition at line 46 of file class.ilLDAPSettingsGUI.php.

◆ $ui_factory

readonly ILIAS UI Factory ilLDAPSettingsGUI::$ui_factory
private

Definition at line 67 of file class.ilLDAPSettingsGUI.php.

Referenced by getRoleAssignmentTable(), and roleMapping().

◆ $ui_renderer

readonly ILIAS UI Renderer ilLDAPSettingsGUI::$ui_renderer
private

Definition at line 68 of file class.ilLDAPSettingsGUI.php.


The documentation for this class was generated from the following file: