Ensure that location and domain are provided together

in our db, {location,domain} is unique. If we replace them one
by one in the database, it will cause conflicts.
This commit is contained in:
Girish Ramakrishnan
2018-12-11 12:10:22 -08:00
parent e7294f2950
commit 0266a46b32
3 changed files with 13 additions and 11 deletions

View File

@@ -667,11 +667,13 @@ function configure(appId, data, user, auditSource, callback) {
if (error) return callback(error);
let domain, location, portBindings, values = { };
if ('location' in data) location = values.location = data.location.toLowerCase();
else location = app.location;
if ('domain' in data) domain = values.domain = data.domain.toLowerCase();
else domain = app.domain;
if ('location' in data && 'domain' in data) {
location = values.location = data.location.toLowerCase();
domain = values.domain = data.domain.toLowerCase();
} else {
location = app.location;
domain = app.domain;
}
if ('accessRestriction' in data) {
values.accessRestriction = data.accessRestriction;