chg: [improvements] to a st of controllers and components to support localtools

- still missing ACL entries!
connector
iglocska 2021-06-01 07:47:22 +02:00
parent 7a1b54c7ab
commit 51b4bc811f
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
3 changed files with 39 additions and 2 deletions

View File

@ -671,6 +671,34 @@ class ACLComponent extends Component
'popup' => 1
]
]
],
'LocalTools' => [
'label' => __('Local Tools'),
'url' => '/localTools/index',
'children' => [
'index' => [
'url' => '/localTools/index',
'label' => __('List Connectors')
],
'viewConnector' => [
'url' => '/localTools/viewConnector/{{connector}}',
'label' => __('View Connector'),
'actions' => ['view'],
'skipTopMenu' => 1
],
'add' => [
'url' => '/localTools/add/{{connector}}',
'label' => __('Add connection'),
'actions' => ['viewConnector'],
'skipTopMenu' => 1
],
'view' => [
'url' => '/localTools/view/{{id}}',
'label' => __('View Connection'),
'actions' => ['view'],
'skipTopMenu' => 1
]
]
]
],
'Cerebrate' => [

View File

@ -38,11 +38,17 @@ class CRUDComponent extends Component
}
$params = $this->Controller->ParamHandler->harvestParams($optionFilters);
$query = $this->Table->find();
if (!empty($options['filterFunction'])) {
$query = $options['filterFunction']($query);
}
$query = $this->setFilters($params, $query, $options);
$query = $this->setQuickFilters($params, $query, empty($options['quickFilters']) ? [] : $options['quickFilters']);
if (!empty($options['contain'])) {
$query->contain($options['contain']);
}
if (!empty($options['fields'])) {
$query->select($options['fields']);
}
if ($this->Controller->ParamHandler->isRest()) {
$data = $query->all();
if (isset($options['afterFind'])) {
@ -323,6 +329,9 @@ class CRUDComponent extends Component
$data = $this->Table->get($id, $params);
$data = $this->attachMetaData($id, $data);
if (isset($params['afterFind'])) {
$data = $params['afterFind']($data);
}
if ($this->Controller->ParamHandler->isRest()) {
$this->Controller->restResponsePayload = $this->Controller->RestResponse->viewData($data, 'json');
}

View File

@ -426,8 +426,8 @@ class RestResponseComponent extends Component
$response = [
'success' => true,
'message' => $message,
'data' => $entity->toArray(),
'url' => $this->__generateURL($action, $ObjectAlias, $entity->id)
'data' => $entity->toArray()
//'url' => $this->__generateURL($action, $ObjectAlias, $entity->id)
];
if (!empty($additionalData)) {
$response['additionalData'] = $additionalData;