fix: [server:add] Pass the correct variables to the view

pull/8053/head
Sami Mokaddem 2021-12-21 16:08:59 +01:00
parent ee4648d3c6
commit 1434e02075
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 7 additions and 4 deletions

View File

@ -445,13 +445,16 @@ class ServersController extends AppController
$allTypes = [];
$this->loadModel('Attribute');
$this->loadModel('ObjectTemplate');
$objects = $this->ObjectTemplate->find('list', [
'fields' => ['name'],
'group' => ['name', 'id'],
$objects = $this->ObjectTemplate->find('all', [
'recursive' => -1,
'fields' => ['uuid', 'name'],
'group' => ['uuid', 'name'],
]);
$allTypes = [
'attribute' => array_unique(Hash::extract(Hash::extract($this->Attribute->categoryDefinitions, '{s}.types'), '{n}.{n}')),
'object' => $objects
'object' => Hash::map($objects, '{n}.ObjectTemplate', function ($item) {
return ['id' => $item['uuid'], 'name' => sprintf('%s (%s)', $item['name'], $item['uuid'])];
})
];
$this->set('host_org_id', Configure::read('MISP.host_org_id'));