| Total Complexity | 8 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class ShareDraftContentControllerExtension extends Extension |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var array |
||
| 12 | */ |
||
| 13 | private static $allowed_actions = [ |
||
|
|
|||
| 14 | 'MakeShareDraftLink', |
||
| 15 | ]; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @return mixed |
||
| 19 | */ |
||
| 20 | public function MakeShareDraftLink() |
||
| 21 | { |
||
| 22 | if ($member = Security::getCurrentUser()) { |
||
| 23 | if ($this->owner->hasMethod('CurrentPage') && $this->owner->CurrentPage()->canView($member)) { |
||
| 24 | return $this->owner->CurrentPage()->ShareTokenLink(); |
||
| 25 | } |
||
| 26 | if ($this->owner->hasMethod('canView') && $this->owner->canView($member)) { |
||
| 27 | return $this->owner->ShareTokenLink(); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | return Security::permissionFailure(); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | public function getShareDraftLinkAction() |
||
| 43 | } |
||
| 44 | } |
||
| 45 |