From d9e09f60a7ee590c34489725d250fe0771bb303c Mon Sep 17 00:00:00 2001 From: "Julien C." Date: Thu, 24 Oct 2024 16:59:47 +0200 Subject: [PATCH] removeMessage(s) only if user is an admin --- core/ajax/message.ajax.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/ajax/message.ajax.php b/core/ajax/message.ajax.php index 4bbd6aef59..ada82cadfc 100644 --- a/core/ajax/message.ajax.php +++ b/core/ajax/message.ajax.php @@ -27,6 +27,9 @@ ajax::init(); if (init('action') == 'clearMessage') { + if(!isConnect('admin')){ + throw new Exception(__('Vous n\'êtes pas autorisé à effectuer cette action', __FILE__)); + } message::removeAll(init('plugin')); ajax::success(); } @@ -46,6 +49,9 @@ } if (init('action') == 'removeMessage') { + if(!isConnect('admin')){ + throw new Exception(__('Vous n\'êtes pas autorisé à effectuer cette action', __FILE__)); + } $message = message::byId(init('id')); if (!is_object($message)) { throw new Exception(__('Message inconnu. Vérifiez l\'ID', __FILE__));