From 1434e02075ba588afb64bd69b9a197b945a67b16 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Tue, 21 Dec 2021 16:08:59 +0100 Subject: [PATCH] fix: [server:add] Pass the correct variables to the view --- app/Controller/ServersController.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Controller/ServersController.php b/app/Controller/ServersController.php index 61a760999..8b5867c97 100644 --- a/app/Controller/ServersController.php +++ b/app/Controller/ServersController.php @@ -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'));