domains: remove locked field

we will do this as part of access control if needed later
This commit is contained in:
Girish Ramakrishnan
2020-02-13 21:12:49 -08:00
parent d1911be28c
commit 25d871860d
7 changed files with 24 additions and 69 deletions
+1 -15
View File
@@ -8,8 +8,6 @@ exports = module.exports = {
del: del,
checkDnsRecords: checkDnsRecords,
verifyDomainLock: verifyDomainLock
};
var assert = require('assert'),
@@ -19,18 +17,6 @@ var assert = require('assert'),
HttpError = require('connect-lastmile').HttpError,
HttpSuccess = require('connect-lastmile').HttpSuccess;
function verifyDomainLock(req, res, next) {
assert.strictEqual(typeof req.params.domain, 'string');
domains.get(req.params.domain, function (error, domain) {
if (error) return next(BoxError.toHttpError(error));
if (domain.locked) return next(new HttpError(423, 'This domain is locked'));
next();
});
}
function add(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
@@ -159,4 +145,4 @@ function checkDnsRecords(req, res, next) {
next(new HttpSuccess(200, { needsOverwrite: result.needsOverwrite }));
});
}
}
-43
View File
@@ -213,49 +213,6 @@ describe('Domains API', function () {
});
});
describe('locked', function () {
before(function (done) {
domaindb.update(DOMAIN_0.domain, { locked: true }, done);
});
after(function (done) {
domaindb.update(DOMAIN_0.domain, { locked: false }, done);
});
it('can list the domains', function (done) {
superagent.get(SERVER_URL + '/api/v1/domains')
.query({ access_token: token })
.end(function (error, result) {
expect(result.statusCode).to.equal(200);
expect(result.body.domains).to.be.an(Array);
expect(result.body.domains.length).to.equal(2);
expect(result.body.domains[0].domain).to.equal(DOMAIN_0.domain);
expect(result.body.domains[1].domain).to.equal(DOMAIN_1.domain);
done();
});
});
it('cannot get locked domain', function (done) {
superagent.get(SERVER_URL + '/api/v1/domains/' + DOMAIN_0.domain)
.query({ access_token: token })
.end(function (error, result) {
expect(result.statusCode).to.equal(423);
done();
});
});
it('cannot delete locked domain', function (done) {
superagent.delete(SERVER_URL + '/api/v1/domains/' + DOMAIN_0.domain)
.query({ access_token: token })
.end(function (error, result) {
expect(result.statusCode).to.equal(423);
done();
});
});
});
describe('delete', function () {
it('fails for non-existing domain', function (done) {
superagent.delete(SERVER_URL + '/api/v1/domains/' + DOMAIN_0.domain + DOMAIN_0.domain)