Refactor lib/Router to use with container for endpoints

[MAILPOET-1605]
This commit is contained in:
Rostislav Wolny
2018-10-17 17:39:32 +02:00
parent 71ad9f50cb
commit fff8176a49
14 changed files with 132 additions and 111 deletions

View File

@@ -17,19 +17,18 @@ class ViewInBrowser {
const ENDPOINT = 'view_in_browser';
const ACTION_VIEW = 'view';
public $allowed_actions = array(self::ACTION_VIEW);
public $data;
public $permissions = array(
'global' => AccessControl::NO_ACCESS_RESTRICTION
);
function __construct($data, AccessControl $access_control) {
function __construct(AccessControl $access_control) {
$this->access_control = $access_control;
$this->data = $this->_processBrowserPreviewData($data);
}
function view() {
function view($data) {
$data = $this->_processBrowserPreviewData($data);
$view_in_browser = new NewsletterViewInBrowser();
return $this->_displayNewsletter($view_in_browser->view($this->data));
return $this->_displayNewsletter($view_in_browser->view($data));
}
function _processBrowserPreviewData($data) {