2021-06-19 13:16:25 +02:00
|
|
|
<?php
|
|
|
|
use Cake\ORM\TableRegistry;
|
|
|
|
|
|
|
|
require_once(ROOT . DS . 'libraries' . DS . 'default' . DS . 'InboxProcessors' . DS . 'GenericOutboxProcessor.php');
|
|
|
|
|
|
|
|
class SCOPE_OutboxProcessor extends GenericOutboxProcessor
|
|
|
|
{
|
|
|
|
protected $scope = '~to-be-defined~';
|
|
|
|
protected $action = 'not-specified'; //overriden when extending
|
|
|
|
protected $description = ''; // overriden when extending
|
|
|
|
protected $registeredActions = [
|
|
|
|
'ACTION'
|
|
|
|
];
|
|
|
|
|
|
|
|
public function __construct($loadFromAction=false) {
|
|
|
|
parent::__construct($loadFromAction);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function create($requestData)
|
|
|
|
{
|
|
|
|
return parent::create($requestData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-21 14:30:32 +02:00
|
|
|
class SCOPE_ACTION_Processor extends ProposalOutboxProcessor implements GenericOutboxProcessorActionI {
|
2021-06-19 13:16:25 +02:00
|
|
|
public $action = 'ACTION';
|
|
|
|
protected $description;
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
parent::__construct();
|
|
|
|
$this->description = __('~to-be-defined~');
|
|
|
|
$this->Users = TableRegistry::getTableLocator()->get('Users');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function addValidatorRules($validator)
|
|
|
|
{
|
|
|
|
return $validator;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function create($requestData) {
|
|
|
|
$this->validateRequestData($requestData);
|
|
|
|
$requestData['title'] = __('~to-be-defined~');
|
|
|
|
return parent::create($requestData);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function process($id, $requestData, $inboxRequest)
|
|
|
|
{
|
|
|
|
$proposalAccepted = false;
|
|
|
|
$saveResult = [];
|
|
|
|
if ($proposalAccepted) {
|
|
|
|
$this->discard($id, $requestData);
|
|
|
|
}
|
|
|
|
return $this->genActionResult(
|
|
|
|
$saveResult,
|
|
|
|
$proposalAccepted,
|
|
|
|
$proposalAccepted ? __('success') : __('fail'),
|
|
|
|
[]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function discard($id, $requestData)
|
|
|
|
{
|
|
|
|
return parent::discard($id, $requestData);
|
|
|
|
}
|
|
|
|
}
|