diff --git a/.gitmodules b/.gitmodules index 52a945b69..49eaadd89 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "libraries/misp-taxonomies"] path = libraries/misp-taxonomies url = https://github.com/MISP/misp-taxonomies +[submodule "libraries/misp-warninglists"] + path = libraries/misp-warninglists + url = https://github.com/MISP/misp-warninglists diff --git a/libraries/misp-warninglists b/libraries/misp-warninglists new file mode 160000 index 000000000..2c7d29985 --- /dev/null +++ b/libraries/misp-warninglists @@ -0,0 +1 @@ +Subproject commit 2c7d29985ef77b568c0cfe3f035414db61f8b74c diff --git a/src/Controller/Component/Navigation/NoticelistsNavigation.php b/src/Controller/Component/Navigation/NoticelistsNavigation.php index 6d41567a6..1cfe51972 100644 --- a/src/Controller/Component/Navigation/NoticelistsNavigation.php +++ b/src/Controller/Component/Navigation/NoticelistsNavigation.php @@ -3,14 +3,18 @@ namespace App\Controller\Component\Navigation; class NoticelistsNavigation extends BaseNavigation { - function addRoutes() + public function addRoutes() { - $this->bcf->addRoute('Noticelists', 'update', [ - 'label' => __('Update Noticelists'), - 'url' => '/noticelists/update', - 'icon' => 'circle-up', - 'isPOST' => true, - ]); + $this->bcf->addRoute( + 'Noticelists', + 'update', + [ + 'label' => __('Update Noticelists'), + 'url' => '/noticelists/update', + 'icon' => 'circle-up', + 'isPOST' => true, + ] + ); } public function addActions() diff --git a/templates/Users/view.php b/templates/Users/view.php index 552519723..def1aa998 100644 --- a/templates/Users/view.php +++ b/templates/Users/view.php @@ -64,7 +64,7 @@ $fields = [ 'type' => 'boolean', 'pill' => true ], - + ]; echo $this->element( '/genericElements/SingleViews/single_view', diff --git a/templates/Warninglists/view.php b/templates/Warninglists/view.php new file mode 100644 index 000000000..f81828f64 --- /dev/null +++ b/templates/Warninglists/view.php @@ -0,0 +1,105 @@ +element( + 'genericElements/SingleViews/single_view', + [ + 'title' => __('Warninglist View'), + 'data' => $entity, + 'fields' => [ + [ + 'key' => __('ID'), + 'path' => 'id' + ], + [ + 'key' => __('Name'), + 'path' => 'name' + ], + [ + 'key' => __('Description'), + 'path' => 'description' + ], + [ + 'key' => __('Version'), + 'path' => 'version' + ], + [ + 'key' => __('Category'), + 'path' => 'category', + 'function' => function (array|\App\Model\Entity\Warninglist $row) use ($possibleCategories) { + return $possibleCategories[$row['category']]; + } + ], + [ + 'key' => __('Type'), + 'path' => 'type' + ], + [ + 'key' => __('Accepted attribute types'), + 'path' => 'type' // FIXME + ] + ], + 'children' => [ + [ + 'url' => '/warninglists/preview_entries/{{0}}', + 'url_params' => ['id'], + 'title' => __('Values'), + 'elementId' => 'preview_entries_container' + ] + ] + ] +); + + +// $types = implode(', ', array_column($warninglist['WarninglistType'], 'type')); +// $table_data = [ +// ['key' => __('ID'), 'value' => $entity['id']], +// ['key' => __('Name'), 'value' => $entity['name']], +// ['key' => __('Description'), 'value' => $entity['description']], +// ['key' => __('Version'), 'value' => $entity['version']], +// ['key' => __('Category'), 'value' => $possibleCategories[$entity['category']]], +// ['key' => __('Type'), 'value' => $entity['type']], +// ['key' => __('Accepted attribute types'), 'value' => $types], +// [ +// 'key' => __('Enabled'), +// 'boolean' => $entity['enabled'], +// 'html' => $me['Role']['perm_warninglist'] ? sprintf( +// ' %s', +// $baseurl, +// h($warninglist['Warninglist']['id']), +// $entity['enabled'] ? '' : '/1', +// $entity['enabled'] ? __('Disable') : __('Enable'), +// $entity['enabled'] ? __('Disable') : __('Enable') +// ) : '', +// ], +// ]; + +// $values = []; +// foreach ($warninglist['WarninglistEntry'] as $entry) { +// $value = '' . h($entry['value']) . ''; +// if ($entry['comment']) { +// $value .= ' # ' . h($entry['comment']) . ''; +// } +// $values[] = $value; +// } + +// echo '