fix: API role edit and user preference add and edit refuse other request methods refs #8299 (#8300)

This commit is contained in:
Jash Ambaliya authored and GitHub committed 2026-11-25 20:41:44 -05:00
1 parent 866400991a
commit d13098901f
4 files changed
+92

No files matched your search

@@ -102,6 +102,7 @@ class UserPreferenceController extends AppController {
* @return void
*/
public function add() {
$this->request->allowMethod('post');
$data = $this->request->data;
if ($this->RequestHandler->requestedWith('json')) {
$data = $this->request->input('json_decode', true) ;
@@ -146,6 +147,7 @@ class UserPreferenceController extends AppController {
* @return void
*/
public function edit($id = null) {
$this->request->allowMethod('post', 'put');
if (!$this->UserPreference->exists($id)) {
throw new NotFoundException(__('Invalid user_preference'));
}