Commit 1674767b authored by Mark Harding's avatar Mark Harding

(fix): only allow the comment owner to edit the comment, not container

parent 828cc2d2
No related merge requests found
Pipeline #69289540 passed with stages
in 8 minutes and 18 seconds
......@@ -99,7 +99,14 @@ class comments implements Interfaces\Api
switch ($pages[0]) {
case "update":
$comment = $manager->getByLuid($pages[1]);
if (!$comment || !$comment->canEdit()) {
$canEdit = $comment->canEdit();
if ($canEdit && $comment->getOwnerGuid() != Core\Session::getLoggedInUserGuid()) {
$canEdit = false;
}
if (!$comment || !$canEdit) {
$response = array('status' => 'error', 'message' => 'This comment can not be edited');
break;
}
......
......@@ -92,7 +92,14 @@ class comments implements Interfaces\Api
switch ($pages[0]) {
case "update":
$comment = $manager->getByLuid($pages[1]);
if (!$comment || !$comment->canEdit()) {
$canEdit = $comment->canEdit();
if ($canEdit && $comment->getOwnerGuid() != Core\Session::getLoggedInUserGuid()) {
$canEdit = false;
}
if (!$comment || !$canEdit) {
$response = array('status' => 'error', 'message' => 'This comment can not be edited');
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment