diff --git a/backend/internal/access-list.js b/backend/internal/access-list.js index 0f62c734..20c8617a 100644 --- a/backend/internal/access-list.js +++ b/backend/internal/access-list.js @@ -30,6 +30,7 @@ const internalAccessList = { .omit(omissions()) .insertAndFetch({ name: data.name, + satify_any: data.satify_any, owner_user_id: access.token.getUserId(1) }); }) @@ -125,7 +126,8 @@ const internalAccessList = { .query() .where({id: data.id}) .patch({ - name: data.name + name: data.name, + satify_any: data.satify_any, }); } }) @@ -478,10 +480,12 @@ const internalAccessList = { return new Promise((resolve, reject) => { let htpasswd_file = internalAccessList.getFilename(list); + let nginx_file = internalAccessList.getFilename(list) + '.conf'; // 1. remove any existing access file try { fs.unlinkSync(htpasswd_file); + fs.unlinkSync(nginx_file); } catch (err) { // do nothing } diff --git a/backend/migrations/20200410143839_access_list_client.js b/backend/migrations/20200410143839_access_list_client.js index 2432d773..3511e35b 100644 --- a/backend/migrations/20200410143839_access_list_client.js +++ b/backend/migrations/20200410143839_access_list_client.js @@ -26,6 +26,13 @@ exports.up = function (knex/*, Promise*/) { }) .then(function () { logger.info('[' + migrate_name + '] access_list_client Table created'); + + return knex.schema.table('access_list', function (access_list) { + access_list.integer('satify_any').notNull().defaultTo(0); + }); + }) + .then(() => { + logger.info('[' + migrate_name + '] access_list Table altered'); }); }; diff --git a/backend/schema/endpoints/access-lists.json b/backend/schema/endpoints/access-lists.json index f2ff254d..18bbf2ae 100644 --- a/backend/schema/endpoints/access-lists.json +++ b/backend/schema/endpoints/access-lists.json @@ -27,6 +27,9 @@ "type": "string", "format": "ipv4" }, + "satify_any": { + "type": "boolean" + }, "meta": { "type": "object" } @@ -86,9 +89,12 @@ "name": { "$ref": "#/definitions/name" }, + "satify_any": { + "$ref": "#/definitions/satify_any" + }, "items": { "type": "array", - "minItems": 1, + "minItems": 0, "items": { "type": "object", "additionalProperties": false, @@ -148,9 +154,12 @@ "name": { "$ref": "#/definitions/name" }, + "satify_any": { + "$ref": "#/definitions/satify_any" + }, "items": { "type": "array", - "minItems": 1, + "minItems": 0, "items": { "type": "object", "additionalProperties": false, diff --git a/frontend/js/app/nginx/access/form.ejs b/frontend/js/app/nginx/access/form.ejs index 9c976b07..40fe8542 100644 --- a/frontend/js/app/nginx/access/form.ejs +++ b/frontend/js/app/nginx/access/form.ejs @@ -21,6 +21,16 @@ + +