diff --git a/routes/acl.js b/routes/acl.js index 13c3844..8dff9d5 100644 --- a/routes/acl.js +++ b/routes/acl.js @@ -222,13 +222,11 @@ router.post('/bulk-add', async (req, res) => { // Process bulk add of ACL entrie entry.StartDate || new Date(), entry.EndDate || new Date(new Date().setFullYear(new Date().getFullYear() + 99)) ]; - if (entry.Doors && typeof entry.Doors === 'object') { - for (const door in entry.Doors) { - if (entry.Doors.hasOwnProperty(door)) { - fields.push(door); - placeholders.push('?'); - values.push(entry.Doors[door] ? 1 : 0); - } + if (Array.isArray(entry.doors)) { + for (const door of entry.doors) { + fields.push(door); + placeholders.push('?'); + values.push(1); } } const sql = `INSERT INTO ACL (${fields.join(', ')}) VALUES (${placeholders.join(', ')})`;