@@ -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