From 08e5f3cf40efe1ec8d1b1ef00c49ee210e94c339 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sat, 2 Jul 2022 14:37:05 +0300 Subject: [PATCH] note only post check 2 --- application/Espo/Services/Note.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/application/Espo/Services/Note.php b/application/Espo/Services/Note.php index 84213a324e..f8071fd44c 100644 --- a/application/Espo/Services/Note.php +++ b/application/Espo/Services/Note.php @@ -169,6 +169,7 @@ class Note extends Record /** * @param NoteEntity $entity * @param stdClass $data + * @throws Forbidden */ protected function beforeUpdateEntity(Entity $entity, $data) { @@ -178,6 +179,10 @@ class Note extends Record $this->handlePostText($entity); } + if (!$entity->isPost() && !$this->user->isAdmin()) { + throw new ForbiddenSilent("Only 'Post' type allowed."); + } + $entity->clear('targetType'); $entity->clear('usersIds'); $entity->clear('teamsIds');