Skip to content

Commit 4e025a4

Browse files
committed
Fix(Core): Optimize container loading when there are a large number of entities
1 parent b97257b commit 4e025a4

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Fixed
1111

1212
- Fix text area fields size and alignment
13+
- Optimize container loading when there are a large number of entities
1314

1415
## [1.24.0] - 2026-04-16
1516

inc/container.class.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,9 +1756,6 @@ public static function findContainer($itemtype, $type = 'tab', $subtype = '')
17561756
['type' => $type],
17571757
];
17581758

1759-
$entity = $_SESSION['glpiactiveentities'] ?? 0;
1760-
$condition += getEntitiesRestrictCriteria('', '', $entity, true, true);
1761-
17621759
if ($subtype != '') {
17631760
if ($subtype == $itemtype . '$main') {
17641761
$condition[] = ['type' => 'dom'];
@@ -1777,7 +1774,7 @@ public static function findContainer($itemtype, $type = 'tab', $subtype = '')
17771774

17781775
foreach ($itemtypes as $data) {
17791776
$dataitemtypes = PluginFieldsToolbox::decodeJSONItemtypes($data['itemtypes']);
1780-
if (in_array($itemtype, $dataitemtypes)) {
1777+
if (in_array($itemtype, $dataitemtypes) && Session::haveAccessToEntity($data['entities_id'], $data['is_recursive'])) {
17811778
$id = $data['id'];
17821779
}
17831780
}
@@ -1797,9 +1794,6 @@ public static function findAllContainers($itemtype)
17971794
{
17981795
$condition = ['is_active' => 1];
17991796

1800-
$entity = $_SESSION['glpiactiveentities'] ?? 0;
1801-
$condition += getEntitiesRestrictCriteria('', '', $entity, true, true);
1802-
18031797
$container = new PluginFieldsContainer();
18041798
$itemtypes = $container->find($condition);
18051799

@@ -1810,7 +1804,7 @@ public static function findAllContainers($itemtype)
18101804
$ids = [];
18111805
foreach ($itemtypes as $data) {
18121806
$dataitemtypes = PluginFieldsToolbox::decodeJSONItemtypes($data['itemtypes']);
1813-
if (in_array($itemtype, $dataitemtypes)) {
1807+
if (in_array($itemtype, $dataitemtypes) && Session::haveAccessToEntity($data['entities_id'], $data['is_recursive'])) {
18141808
$id = $data['id'];
18151809
//profiles restriction
18161810
if (isset($_SESSION['glpiactiveprofile']['id']) && $_SESSION['glpiactiveprofile']['id'] != null && $id > 0) {

0 commit comments

Comments
 (0)