Skip to content

Commit e6e429e

Browse files
cosmeddbtry
authored andcommitted
Restrict available LDAP servers.
You can view any available LDAP if you have access to the root entity. Otherwise, only the LDAP configured as the default for the current entity is displayed.
1 parent d6e40a2 commit e6e429e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

inc/fields/ldapselectfield.class.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ public function getDesignSpecializationField() {
4242
if ($ldap_values === null) {
4343
$ldap_values = [];
4444
}
45-
$field = Dropdown::show('AuthLDAP', [
45+
$current_entity = $_SESSION['glpiactive_entity'];
46+
$auth_ldap_condition = '';
47+
if ($current_entity != 0) {
48+
$auth_ldap_condition = "glpi_authldaps.id = (select glpi_entities.authldaps_id from glpi_entities where id=${current_entity})";
49+
}
50+
$field = Dropdown::show(AuthLDAP::class, [
4651
'name' => 'ldap_auth',
52+
'condition' => $auth_ldap_condition,
4753
'rand' => $rand,
4854
'value' => (isset($ldap_values['ldap_auth'])) ? $ldap_values['ldap_auth'] : '',
4955
'on_change' => 'plugin_formcreator_changeLDAP(this)',

0 commit comments

Comments
 (0)