chg: [improvements] to a st of controllers and components to support localtools
- still missing ACL entries!connector
parent
7a1b54c7ab
commit
51b4bc811f
|
@ -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' => [
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue