Fix deleting IP ranges (v4 or v6) in whitelist blacklist, etc

dev
Thomas Lynch 4 months ago
parent 0bdfb33523
commit eab91d7844
  1. 9
      controllers/maps.js

@ -130,13 +130,16 @@ export async function deleteMapForm(req, res, next) {
|| req.params.name === process.env.BLOCKED_CN_MAP_NAME
|| req.params.name === process.env.WHITELIST_MAP_NAME) {
let value;
const existingEntry = await res.locals
.dataPlaneRetry('getRuntimeMapEntry', {
const existingEntries = await res.locals
.dataPlaneRetry('showRuntimeMap', {
map: req.params.name,
id: req.body.key,
// id: req.body.key,
})
.then((res) => res.data)
.catch(() => {});
const existingEntry = existingEntries && existingEntries
.find(en => en.key === req.body.key);
console.log('existingEntry', existingEntry);
if (existingEntry && existingEntry.value) {
let existingEntries = existingEntry.value.split(':');
if (!existingEntries || !existingEntries.includes(res.locals.user.username)) {

Loading…
Cancel
Save