Skip to content

Commit

Permalink
fix(ldapfield): raw condition expression must be replaced by array
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Feb 2, 2022

Unverified

No user is associated with the committer email.
1 parent 4a0a719 commit 7620249
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions inc/field/ldapselectfield.class.php
Original file line number Diff line number Diff line change
@@ -36,7 +36,9 @@
use AuthLDAP;
use Dropdown;
use Exception;
use Entity;
use Html;
use QuerySubQuery;
use Session;
use RuleRightParameter;

@@ -53,10 +55,17 @@ public function getDesignSpecializationField(): array {
if ($ldap_values === null) {
$ldap_values = [];
}
$current_entity = $_SESSION['glpiactive_entity'];
$current_entity = Session::getActiveEntity();
$auth_ldap_condition = '';
if ($current_entity != 0) {
$auth_ldap_condition = "glpi_authldaps.id = (select glpi_entities.authldaps_id from glpi_entities where id=${current_entity})";
$entityTable = Entity::getTable();
$auth_ldap_condition = [
'glpi_authldaps.id' => new QuerySubQuery([
'SELECT' => "$entityTable.authldaps_id",
'FROM' => $entityTable,
'WHERE' => ['id' => $current_entity],
])
];
}
$field = Dropdown::show(AuthLDAP::class, [
'name' => 'ldap_auth',

0 comments on commit 7620249

Please sign in to comment.