diff --git a/lib/generators.js b/lib/generators.js index d633df4..2ecd751 100644 --- a/lib/generators.js +++ b/lib/generators.js @@ -1,7 +1,7 @@ const crypto = require('crypto'); // Characters used when generating a random API key: letters, digits and a handful of symbols. -const API_KEY_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+'; +const API_KEY_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; const API_KEY_LENGTH = 64; // Characters used when generating a random reader id: letters and digits only. diff --git a/migrations/0006_lockdown.sql b/migrations/0006_lockdown.sql new file mode 100644 index 0000000..4149649 --- /dev/null +++ b/migrations/0006_lockdown.sql @@ -0,0 +1,11 @@ +-- Single-row table holding the global lockdown state. When active, every reader at every place +-- is disabled and all scans are denied, regardless of that reader's own enabled/armState/ACL config. +CREATE TABLE IF NOT EXISTS system_lockdown ( + id INTEGER PRIMARY KEY CHECK (id = 1), + active INTEGER NOT NULL DEFAULT 0, + activatedBy INTEGER, + activatedAt DATETIME, + FOREIGN KEY(activatedBy) REFERENCES users(id) +); + +INSERT OR IGNORE INTO system_lockdown (id, active) VALUES (1, 0); diff --git a/migrations/0007_place_lockdown.sql b/migrations/0007_place_lockdown.sql new file mode 100644 index 0000000..bd0f789 --- /dev/null +++ b/migrations/0007_place_lockdown.sql @@ -0,0 +1,6 @@ +-- Per-place lockdown, separate from the global (all-places) lockdown in system_lockdown. Unlike the +-- global lockdown, this can be engaged/lifted by anyone with access to the place (owner, shared +-- access, or elevated/admin bypass) - see routes/dashboard.js. +ALTER TABLE places ADD COLUMN lockdown INTEGER NOT NULL DEFAULT 0; +ALTER TABLE places ADD COLUMN lockdownActivatedBy INTEGER REFERENCES users(id); +ALTER TABLE places ADD COLUMN lockdownActivatedAt DATETIME; diff --git a/public/admin/index.html b/public/admin/index.html index 1cc13b8..c89ea4d 100644 --- a/public/admin/index.html +++ b/public/admin/index.html @@ -20,6 +20,16 @@
While engaged, every reader at every place is disabled and all scans are denied, regardless of that reader's own settings, until the lockdown is lifted.
+