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 ab3b98e commit b25abfb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion applications/vanilla/controllers/class.postcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,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->Discussion = $this->DiscussionModel->GetID($DiscussionID);
$this->CategoryID = $this->Discussion->CategoryID;
Expand Down Expand Up @@ -540,4 +544,4 @@ public function Initialize() {
parent::Initialize();
$this->AddCssFile('vanilla.css');
}
}
}

0 comments on commit b25abfb

Please sign in to comment.