From e525b3a82b1fd4f9c338684dcc33107b1b7a864b Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Thu, 1 Dec 2022 11:46:40 +0100 Subject: [PATCH] fix(glpiselectfield): restore entity restriction for users --- inc/field/glpiselectfield.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/field/glpiselectfield.class.php b/inc/field/glpiselectfield.class.php index 89997a1e6..752afd8c9 100644 --- a/inc/field/glpiselectfield.class.php +++ b/inc/field/glpiselectfield.class.php @@ -39,6 +39,7 @@ use Entity; use CommonTreeDropdown; use CommonDBTM; +use User; use GlpiPlugin\Formcreator\Exception\ComparisonException; use Glpi\Application\View\TemplateRenderer; @@ -60,10 +61,11 @@ public function showForm(array $options): void { $item = new $this->question->fields['itemtype']; $this->question->fields['_is_entity_restrict'] = $item->isEntityAssign() ? '1' : '0'; } + if (isset($this->question->fields['itemtype']) && $this->question->fields['itemtype'] == User::class) { + $this->question->fields['_is_entity_restrict'] = '1'; + } if (isset($this->question->fields['itemtype']) && is_subclass_of($this->question->fields['itemtype'], CommonTreeDropdown::class)) { $this->question->fields['_is_tree'] = '1'; - // $item = new $this->question->fields['itemtype']; - // $this->question->fields['_is_entity_restrict'] = $item->isEntityAssign() ? '1' : '0'; } $this->question->fields['default_values'] = Html::entities_deep($this->question->fields['default_values']); $this->deserializeValue($this->question->fields['default_values']);