Skip to content

Commit 944d28a

Browse files
authored
Merge pull request #710 from favicode/feature/ngwaf-dictionary-implementation
NGWAF dictionary check
2 parents ef9fb91 + e12b870 commit 944d28a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

Controller/Adminhtml/FastlyCdn/Edge/Dictionary/ListAll.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class ListAll extends Action
3535
{
3636
const ADMIN_RESOURCE = 'Magento_Config::config';
3737

38+
const NGWAF_DICTIONARY_NAME = "Edge_Security";
39+
3840
/**
3941
* @var Http
4042
*/
@@ -96,6 +98,14 @@ public function execute()
9698
]);
9799
}
98100

101+
// This dictionary represents NGWAF, used while migrating customers from WAF. Adobe is requesting that
102+
// their customers shouldn't be able to disable it, so we remove it from Admin listing.
103+
foreach ($dictionaries as $key => $dictionary) {
104+
if (isset($dictionary->name) && $dictionary->name === self::NGWAF_DICTIONARY_NAME) {
105+
array_splice($dictionaries, $key, 1);
106+
}
107+
}
108+
99109
return $result->setData([
100110
'status' => true,
101111
'dictionaries' => $dictionaries

view/adminhtml/web/js/edge-dictionaries.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,11 @@ define([
7272
listDictionaries(active_version, false).done(function (response) {
7373
$('.loading-dictionaries').hide();
7474
if (response.status !== false) {
75-
if (response.status !== false) {
76-
if (response.dictionaries.length > 0) {
77-
dictionaries = response.dictionaries;
78-
processDictionaries(response.dictionaries);
79-
} else {
80-
$('.no-dictionaries').show();
81-
}
75+
if (response.dictionaries.length > 0) {
76+
dictionaries = response.dictionaries;
77+
processDictionaries(response.dictionaries);
78+
} else {
79+
$('.no-dictionaries').show();
8280
}
8381
}
8482
}).fail(function () {

0 commit comments

Comments
 (0)