Skip to content

Commit 42cdcaa

Browse files
Rom1-Bstonebuzz
andauthored
Fix: front/ check (#949)
* Fix: front/ check * add check * return * lint --------- Co-authored-by: Stanislas <skita@teclib.com>
1 parent 66b0749 commit 42cdcaa

17 files changed

+31
-4
lines changed

ajax/container.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,18 @@
2929
*/
3030

3131
include('../../../inc/includes.php');
32+
Session::checkLoginUser();
3233

3334
use Glpi\Http\Response;
3435

3536
if (isset($_GET['action']) && $_GET['action'] === 'get_fields_html') {
37+
38+
$right = PluginFieldsProfile::getRightOnContainer($_SESSION['glpiactiveprofile']['id'], $_GET['id']);
39+
if ($right < READ) {
40+
Response::sendError(403, 'Forbidden');
41+
return;
42+
}
43+
3644
$containers_id = $_GET['id'];
3745
$itemtype = $_GET['itemtype'];
3846
$items_id = (int) $_GET['items_id'];

ajax/container_display_condition.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030

3131
include('../../../inc/includes.php');
32+
Session::checkLoginUser();
3233

3334
if (isset($_GET['action'])) {
3435
if ($_GET['action'] === 'get_add_form') {

ajax/container_itemtypes_dropdown.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929
*/
3030

3131
include('../../../inc/includes.php');
32+
Session::checkLoginUser();
3233

3334
PluginFieldsContainer::showFormItemtype($_REQUEST);

ajax/container_subtype_dropdown.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929
*/
3030

3131
include('../../../inc/includes.php');
32+
Session::checkLoginUser();
3233

3334
PluginFieldsContainer::showFormSubtype($_REQUEST, true);

ajax/reorder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030

3131
include('../../../inc/includes.php');
32+
Session::checkLoginUser();
3233

3334
if (
3435
!array_key_exists('container_id', $_POST)

ajax/status_override.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030

3131
include('../../../inc/includes.php');
32+
Session::checkLoginUser();
3233

3334
if (isset($_GET['action'])) {
3435
if ($_GET['action'] === 'get_status_dropdown') {

front/commondropdown.form.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030

3131
include '../../../inc/includes.php';
32+
Session::checkLoginUser();
3233
if (preg_match('/[a-z]/i', $_REQUEST['ddtype']) !== 1) {
3334
throw new \RuntimeException(sprintf('Invalid itemtype "%1$s"', $_REQUEST['ddtype']));
3435
}

front/commondropdown.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030

3131
include '../../../inc/includes.php';
32+
Session::checkLoginUser();
3233
if (preg_match('/[a-z]/i', $_REQUEST['ddtype']) !== 1) {
3334
throw new \RuntimeException(sprintf('Invalid itemtype "%1$s"', $_REQUEST['ddtype']));
3435
}

front/container.form.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030

3131
include('../../../inc/includes.php');
32+
Session::checkLoginUser();
3233

3334
if (empty($_GET['id'])) {
3435
$_GET['id'] = '';
@@ -59,6 +60,12 @@
5960
}
6061
Html::back();
6162
} else {
63+
64+
$right = PluginFieldsProfile::getRightOnContainer($_SESSION['glpiactiveprofile']['id'], $_GET['id']);
65+
if ($right < READ) {
66+
Html::displayRightError("User is missing the " . READ . " ('read') right for container");
67+
}
68+
6269
Html::header(
6370
__('Additional fields', 'fields'),
6471
$_SERVER['PHP_SELF'],

front/container.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030

3131
include('../../../inc/includes.php');
32+
Session::checkLoginUser();
3233

3334
Html::header(
3435
__('Additional fields', 'fields'),
@@ -38,7 +39,7 @@
3839
'fieldscontainer',
3940
);
4041

41-
Session::checkRight('entity', READ);
42+
Session::checkRight('config', READ);
4243

4344
PluginFieldsContainer::titleList();
4445
Search::show('PluginFieldsContainer');

0 commit comments

Comments
 (0)