Skip to content

Commit e525b3a

Browse files
committed
fix(glpiselectfield): restore entity restriction for users
1 parent d61b101 commit e525b3a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

inc/field/glpiselectfield.class.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
use Entity;
4040
use CommonTreeDropdown;
4141
use CommonDBTM;
42+
use User;
4243

4344
use GlpiPlugin\Formcreator\Exception\ComparisonException;
4445
use Glpi\Application\View\TemplateRenderer;
@@ -60,10 +61,11 @@ public function showForm(array $options): void {
6061
$item = new $this->question->fields['itemtype'];
6162
$this->question->fields['_is_entity_restrict'] = $item->isEntityAssign() ? '1' : '0';
6263
}
64+
if (isset($this->question->fields['itemtype']) && $this->question->fields['itemtype'] == User::class) {
65+
$this->question->fields['_is_entity_restrict'] = '1';
66+
}
6367
if (isset($this->question->fields['itemtype']) && is_subclass_of($this->question->fields['itemtype'], CommonTreeDropdown::class)) {
6468
$this->question->fields['_is_tree'] = '1';
65-
// $item = new $this->question->fields['itemtype'];
66-
// $this->question->fields['_is_entity_restrict'] = $item->isEntityAssign() ? '1' : '0';
6769
}
6870
$this->question->fields['default_values'] = Html::entities_deep($this->question->fields['default_values']);
6971
$this->deserializeValue($this->question->fields['default_values']);

0 commit comments

Comments
 (0)