Skip to content

Commit

Permalink
FIX Generating a share draft link now only requires canView() permiss…
Browse files Browse the repository at this point in the history
…ions rather than canEdit()
  • Loading branch information
robbieaverill committed Mar 12, 2019
1 parent 9c8a482 commit 652f9aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -14,7 +14,7 @@ This module adds a 'Share draft' action menu to the CMS. This enables Content Au

## Requirements

- SilverStripe ^4.2
- SilverStripe ^4.3

Note: this version is compatible with SilverStripe 4. For SilverStripe 3, please see the 1.x release line.

Expand Down
9 changes: 5 additions & 4 deletions src/Extensions/ShareDraftContentControllerExtension.php
Expand Up @@ -10,19 +10,20 @@ class ShareDraftContentControllerExtension extends Extension
/**
* @var array
*/
private static $allowed_actions = array(
private static $allowed_actions = [
'MakeShareDraftLink',
);
];

/**
* @return mixed
*/
public function MakeShareDraftLink()
{
if ($member = Security::getCurrentUser()) {
if ($this->owner->hasMethod('CurrentPage') && $this->owner->CurrentPage()->canEdit($member)) {
if ($this->owner->hasMethod('CurrentPage') && $this->owner->CurrentPage()->canView($member)) {
return $this->owner->CurrentPage()->ShareTokenLink();
} elseif ($this->owner->hasMethod('canEdit') && $this->owner->canEdit($member)) {
}
if ($this->owner->hasMethod('canView') && $this->owner->canView($member)) {
return $this->owner->ShareTokenLink();
}
}
Expand Down

0 comments on commit 652f9aa

Please sign in to comment.