domains: remove locked field
we will do this as part of access control if needed later
This commit is contained in:
+1
-15
@@ -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 }));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user