Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [UNRELEASED]

### Fixed

- Optimize container loading when there are a large number of entities

## [1.24.0] - 2026-04-16

### Added
Expand Down
10 changes: 2 additions & 8 deletions inc/container.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1756,9 +1756,6 @@ public static function findContainer($itemtype, $type = 'tab', $subtype = '')
['type' => $type],
];

$entity = $_SESSION['glpiactiveentities'] ?? 0;
$condition += getEntitiesRestrictCriteria('', '', $entity, true, true);

if ($subtype != '') {
if ($subtype == $itemtype . '$main') {
$condition[] = ['type' => 'dom'];
Expand All @@ -1777,7 +1774,7 @@ public static function findContainer($itemtype, $type = 'tab', $subtype = '')

foreach ($itemtypes as $data) {
$dataitemtypes = PluginFieldsToolbox::decodeJSONItemtypes($data['itemtypes']);
if (in_array($itemtype, $dataitemtypes)) {
if (in_array($itemtype, $dataitemtypes) && Session::haveAccessToEntity($data['entities_id'], $data['is_recursive'])) {
$id = $data['id'];
}
}
Expand All @@ -1797,9 +1794,6 @@ public static function findAllContainers($itemtype)
{
$condition = ['is_active' => 1];

$entity = $_SESSION['glpiactiveentities'] ?? 0;
$condition += getEntitiesRestrictCriteria('', '', $entity, true, true);

$container = new PluginFieldsContainer();
$itemtypes = $container->find($condition);

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