本文整理汇总了PHP中Tracker_Artifact::userCanUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracker_Artifact::userCanUpdate方法的具体用法?PHP Tracker_Artifact::userCanUpdate怎么用?PHP Tracker_Artifact::userCanUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracker_Artifact
的用法示例。
在下文中一共展示了Tracker_Artifact::userCanUpdate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkArtifact
private function checkArtifact(PFUser $user, Tracker_Artifact $artifact)
{
if (!$artifact) {
throw new \Luracast\Restler\RestException(404, 'Artifact not found');
}
if (!$artifact->userCanUpdate($user)) {
throw new \Luracast\Restler\RestException(403, 'You have not the permission to update this card');
}
if ($this->clientWantsToUpdateLatestVersion() && !$this->isUpdatingLatestVersion($artifact)) {
throw new \Luracast\Restler\RestException(412, 'Artifact has been modified since you last requested it. Please edit the latest version');
}
}
示例2: addFollowUp
/** @return Tracker_Artifact_Changeset */
private function addFollowUp(PFUser $user, Tracker_Artifact $artifact, $body)
{
$this->logger->debug("Receiving new follow-up comment from " . $user->getUserName());
if (!$artifact->userCanUpdate($user)) {
$this->logger->info("User " . $user->getUnixName() . " has no right to update the artifact #" . $artifact->getId());
$this->notifier->sendErrorMailInsufficientPermissionUpdate($user->getEmail(), $artifact->getId());
return;
}
return $artifact->createNewChangeset(array(), $body, $user, true, Tracker_Artifact_Changeset_Comment::TEXT_COMMENT);
}