Skip to content

Commit 4a79178

Browse files
committed
Revert "fix(itil): Move back readonly logic in the object with API having passing throug"
This reverts commit ac14bf1.
1 parent ac14bf1 commit 4a79178

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

front/change.form.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
if (isset($_POST["add"])) {
5454
$change->check(-1, CREATE, $_POST);
5555

56+
$_POST = $change->enforceReadonlyFields($_POST, true);
5657
$newID = $change->add($_POST);
5758
Event::log(
5859
$newID,
@@ -109,6 +110,7 @@
109110
} elseif (isset($_POST["update"])) {
110111
$change->check($_POST["id"], UPDATE);
111112

113+
$_POST = $change->enforceReadonlyFields($_POST);
112114
$change->update($_POST);
113115
Event::log(
114116
$_POST["id"],

front/problem.form.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
if (isset($_POST["add"])) {
5454
$problem->check(-1, CREATE, $_POST);
5555

56+
$_POST = $problem->enforceReadonlyFields($_POST, true);
5657
if ($newID = $problem->add($_POST)) {
5758
Event::log(
5859
$newID,
@@ -108,6 +109,7 @@
108109
} elseif (isset($_POST["update"])) {
109110
$problem->check($_POST["id"], UPDATE);
110111

112+
$_POST = $problem->enforceReadonlyFields($_POST);
111113
$problem->update($_POST);
112114
Event::log(
113115
$_POST["id"],

front/ticket.form.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474

7575
if (isset($_POST["add"])) {
7676
$track->check(-1, CREATE, $_POST);
77+
$_POST = $track->enforceReadonlyFields($_POST, true);
7778

7879
if ($track->add($_POST)) {
7980
if ($_SESSION['glpibackcreated']) {
@@ -85,6 +86,7 @@
8586
if (!$track::canUpdate()) {
8687
throw new AccessDeniedHttpException();
8788
}
89+
$_POST = $track->enforceReadonlyFields($_POST);
8890
$track->update($_POST);
8991

9092
if (isset($_POST['kb_linked_id'])) {

src/CommonITILObject.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,8 +1967,6 @@ public function prepareInputForUpdate($input)
19671967
return false;
19681968
}
19691969

1970-
$input = $this->enforceReadonlyFields($input);
1971-
19721970
// Add document if needed
19731971
$this->getFromDB($input["id"]); // entities_id field required
19741972

@@ -2345,11 +2343,6 @@ public function prepareInputForUpdate($input)
23452343
*/
23462344
public function enforceReadonlyFields(array $input, bool $isAdd = false): array
23472345
{
2348-
// No enforcing for API
2349-
if (isAPI() || isCommandLine()) {
2350-
return $input;
2351-
}
2352-
23532346
$tt = $this->getITILTemplateFromInput($input);
23542347
if (!$tt) {
23552348
return $input;
@@ -2845,8 +2838,6 @@ public function prepareInputForAdd($input)
28452838
return false;
28462839
}
28472840

2848-
$input = $this->enforceReadonlyFields($input, true);
2849-
28502841
$input = $this->transformActorsInput($input);
28512842

28522843
// Map unique template field to template foreign key

0 commit comments

Comments
 (0)