Skip to content

Commit

Permalink
Drafts: verify ownership in editdiscussion for #1672
Browse files Browse the repository at this point in the history
  • Loading branch information
linc committed Mar 15, 2014
1 parent 79c9016 commit 77b0517
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion applications/vanilla/controllers/class.postcontroller.php
Expand Up @@ -291,6 +291,10 @@ public function EditDiscussion($DiscussionID = '', $DraftID = '') {
if ($DraftID != '') {
$this->Draft = $this->DraftModel->GetID($DraftID);
$this->CategoryID = $this->Draft->CategoryID;

// Verify this is their draft
if (GetValue('InsertUserID', $this->Draft) != Gdn::Session()->UserID)
throw PermissionException();
} else {
$this->SetData('Discussion', $this->DiscussionModel->GetID($DiscussionID), TRUE);
$this->CategoryID = $this->Discussion->CategoryID;
Expand Down Expand Up @@ -804,4 +808,4 @@ function CheckOrRadio($FieldName, $LabelCode, $ListOptions, $Attributes = array(
$Result .= '</ul>';
return $Result;
}
}
}

0 comments on commit 77b0517

Please sign in to comment.