File tree Expand file tree Collapse file tree 4 files changed +6
-9
lines changed Expand file tree Collapse file tree 4 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 5353if (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 ,
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 " ],
Original file line number Diff line number Diff line change 5353if (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 ,
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 " ],
Original file line number Diff line number Diff line change 7474
7575if (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 ' ]) {
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 ' ])) {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments