Only allow comment creator to delete comment

This commit is contained in:
raimund-schluessler 2014-07-19 11:55:39 +02:00
parent bef06fb3f3
commit a1c8892afa

View file

@ -540,12 +540,16 @@ class TasksController extends Controller {
$vcalendar = \OC_Calendar_App::getVCalendar($taskId);
$vtodo = $vcalendar->VTODO;
$commentIndex = $this->getCommentById($vtodo,$commentId);
unset($vtodo->children[$commentIndex]);
\OC_Calendar_Object::edit($taskId, $vcalendar->serialize());
$comment = $vtodo->children[$commentIndex];
if($comment['USERID'] == $userId){
unset($vtodo->children[$commentIndex]);
\OC_Calendar_Object::edit($taskId, $vcalendar->serialize());
}else{
throw new \Exception('Not allowed.');
}
} catch(\Exception $e) {
// throw new BusinessLayerException($e->getMessage());
}
$response->setData();
return $response;
}