/** * @return bool */ public function canEdit() { $userId = $this->getUser()->getId(); // admin is always able to edit\remove comments if (Loader::includeModule("tasks") && (\CTasksTools::isAdmin($userId) || \CTasksTools::isPortalB24Admin($userId))) { return true; } return false; }
/** * @return bool */ public function canEdit() { $userId = $this->getUser()->getId(); // admin is always able to edit\remove comments if (Loader::includeModule("tasks") && (\CTasksTools::isAdmin($userId) || \CTasksTools::IsPortalB24Admin($userId))) { return true; } // if you are not an admin, you must obey "tasks" module settings if (!static::checkEditOptionIsOn()) { return false; } // you are not allowed to view the task, so you can not edit messages either (even own) if (!$this->checkHasAccess()) { return false; } // in all other ways - depends on "forum" module settings return parent::canEdit(); }
/** * @deprecated */ private static function CheckUpdateRemoveCandidate($taskId, $commentId, $userId, $arParams) { $filter = array('TOPIC_ID' => $arParams['FORUM_TOPIC_ID']); // have no idea in which case the following parameters will be used: if (isset($arParams['FORUM_ID'])) { $filter['FORUM_ID'] = $arParams['FORUM_ID']; } if (isset($arParams['APPROVED'])) { $filter['APPROVED'] = $arParams['APPROVED']; } $res = CForumMessage::GetListEx(array('ID' => 'ASC'), $filter, false, 0, array('bShowAll' => true)); // Take last message $comment = false; $lastComment = false; $cnt = 0; while ($ar = $res->fetch()) { if ($ar['ID'] == $commentId) { $comment = $ar; } $lastComment = $ar; $cnt++; } if ($cnt == 0) { // no comments in the topic return false; } if (empty($comment)) { // comment not found return false; } if (CTasksTools::isAdmin($userId) || CTasksTools::IsPortalB24Admin($userId)) { return true; } elseif ($userId == $lastComment['AUTHOR_ID']) { if ($commentId != $lastComment['ID']) { // it's not the last comment return false; } else { return true; } } else { return false; } }