group -> list
This commit is contained in:
@@ -371,7 +371,7 @@ function mailingListSearch(req, res, next) {
|
|||||||
var parts = email.split('@');
|
var parts = email.split('@');
|
||||||
if (parts.length !== 2) return next(new ldap.NoSuchObjectError(req.dn.toString()));
|
if (parts.length !== 2) return next(new ldap.NoSuchObjectError(req.dn.toString()));
|
||||||
|
|
||||||
mailboxdb.getGroup(parts[0], parts[1], function (error, group) {
|
mailboxdb.getList(parts[0], parts[1], function (error, group) {
|
||||||
if (error && error.reason === DatabaseError.NOT_FOUND) return next(new ldap.NoSuchObjectError(req.dn.toString()));
|
if (error && error.reason === DatabaseError.NOT_FOUND) return next(new ldap.NoSuchObjectError(req.dn.toString()));
|
||||||
if (error) return next(new ldap.OperationsError(error.toString()));
|
if (error) return next(new ldap.OperationsError(error.toString()));
|
||||||
|
|
||||||
|
|||||||
@@ -1203,7 +1203,7 @@ function getLists(domain, callback) {
|
|||||||
assert.strictEqual(typeof domain, 'string');
|
assert.strictEqual(typeof domain, 'string');
|
||||||
assert.strictEqual(typeof callback, 'function');
|
assert.strictEqual(typeof callback, 'function');
|
||||||
|
|
||||||
mailboxdb.listGroups(domain, function (error, result) {
|
mailboxdb.getLists(domain, function (error, result) {
|
||||||
if (error) return callback(new MailError(MailError.INTERNAL_ERROR, error));
|
if (error) return callback(new MailError(MailError.INTERNAL_ERROR, error));
|
||||||
|
|
||||||
callback(null, result);
|
callback(null, result);
|
||||||
@@ -1215,7 +1215,7 @@ function getList(domain, listName, callback) {
|
|||||||
assert.strictEqual(typeof listName, 'string');
|
assert.strictEqual(typeof listName, 'string');
|
||||||
assert.strictEqual(typeof callback, 'function');
|
assert.strictEqual(typeof callback, 'function');
|
||||||
|
|
||||||
mailboxdb.getGroup(listName, domain, function (error, result) {
|
mailboxdb.getList(listName, domain, function (error, result) {
|
||||||
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new MailError(MailError.NOT_FOUND, 'no such list'));
|
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new MailError(MailError.NOT_FOUND, 'no such list'));
|
||||||
if (error) return callback(new MailError(MailError.INTERNAL_ERROR, error));
|
if (error) return callback(new MailError(MailError.INTERNAL_ERROR, error));
|
||||||
|
|
||||||
@@ -1242,7 +1242,7 @@ function addList(name, domain, members, auditSource, callback) {
|
|||||||
if (error) return callback(error);
|
if (error) return callback(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
mailboxdb.addGroup(name, domain, members, function (error) {
|
mailboxdb.addList(name, domain, members, function (error) {
|
||||||
if (error && error.reason === DatabaseError.ALREADY_EXISTS) return callback(new MailError(MailError.ALREADY_EXISTS, 'list already exits'));
|
if (error && error.reason === DatabaseError.ALREADY_EXISTS) return callback(new MailError(MailError.ALREADY_EXISTS, 'list already exits'));
|
||||||
if (error) return callback(new MailError(MailError.INTERNAL_ERROR, error));
|
if (error) return callback(new MailError(MailError.INTERNAL_ERROR, error));
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
exports = module.exports = {
|
exports = module.exports = {
|
||||||
addMailbox: addMailbox,
|
addMailbox: addMailbox,
|
||||||
addGroup: addGroup,
|
addList: addList,
|
||||||
|
|
||||||
updateMailboxOwner: updateMailboxOwner,
|
updateMailboxOwner: updateMailboxOwner,
|
||||||
updateList: updateList,
|
updateList: updateList,
|
||||||
@@ -10,10 +10,10 @@ exports = module.exports = {
|
|||||||
|
|
||||||
listAliases: listAliases,
|
listAliases: listAliases,
|
||||||
listMailboxes: listMailboxes,
|
listMailboxes: listMailboxes,
|
||||||
listGroups: listGroups,
|
getLists: getLists,
|
||||||
|
|
||||||
getMailbox: getMailbox,
|
getMailbox: getMailbox,
|
||||||
getGroup: getGroup,
|
getList: getList,
|
||||||
getAlias: getAlias,
|
getAlias: getAlias,
|
||||||
|
|
||||||
getAliasesForName: getAliasesForName,
|
getAliasesForName: getAliasesForName,
|
||||||
@@ -75,7 +75,7 @@ function updateMailboxOwner(name, domain, ownerId, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addGroup(name, domain, members, callback) {
|
function addList(name, domain, members, callback) {
|
||||||
assert.strictEqual(typeof name, 'string');
|
assert.strictEqual(typeof name, 'string');
|
||||||
assert.strictEqual(typeof domain, 'string');
|
assert.strictEqual(typeof domain, 'string');
|
||||||
assert(Array.isArray(members));
|
assert(Array.isArray(members));
|
||||||
@@ -197,7 +197,7 @@ function listMailboxes(domain, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function listGroups(domain, callback) {
|
function getLists(domain, callback) {
|
||||||
assert.strictEqual(typeof domain, 'string');
|
assert.strictEqual(typeof domain, 'string');
|
||||||
assert.strictEqual(typeof callback, 'function');
|
assert.strictEqual(typeof callback, 'function');
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ function listGroups(domain, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGroup(name, domain, callback) {
|
function getList(name, domain, callback) {
|
||||||
assert.strictEqual(typeof name, 'string');
|
assert.strictEqual(typeof name, 'string');
|
||||||
assert.strictEqual(typeof domain, 'string');
|
assert.strictEqual(typeof domain, 'string');
|
||||||
assert.strictEqual(typeof callback, 'function');
|
assert.strictEqual(typeof callback, 'function');
|
||||||
|
|||||||
@@ -2127,7 +2127,7 @@ describe('database', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('cannot get non-existing group', function (done) {
|
it('cannot get non-existing group', function (done) {
|
||||||
mailboxdb.getGroup('random', DOMAIN_0.domain, function (error) {
|
mailboxdb.getList('random', DOMAIN_0.domain, function (error) {
|
||||||
expect(error.reason).to.be(DatabaseError.NOT_FOUND);
|
expect(error.reason).to.be(DatabaseError.NOT_FOUND);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ describe('Groups', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('did delete mailbox', function (done) {
|
it('did delete mailbox', function (done) {
|
||||||
mailboxdb.getGroup(GROUP0_NAME.toLowerCase(), DOMAIN_0.domain, function (error) {
|
mailboxdb.getList(GROUP0_NAME.toLowerCase(), DOMAIN_0.domain, function (error) {
|
||||||
expect(error.reason).to.be(DatabaseError.NOT_FOUND);
|
expect(error.reason).to.be(DatabaseError.NOT_FOUND);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -787,7 +787,7 @@ describe('Ldap', function () {
|
|||||||
|
|
||||||
describe('search mailing list', function () {
|
describe('search mailing list', function () {
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
mailboxdb.addGroup('devs', DOMAIN_0.domain, [ USER_0.username.toLowerCase(), USER_1.username.toLowerCase() ], done);
|
mailboxdb.addList('devs', DOMAIN_0.domain, [ USER_0.username.toLowerCase(), USER_1.username.toLowerCase() ], done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('get specific list', function (done) {
|
it('get specific list', function (done) {
|
||||||
|
|||||||
Reference in New Issue
Block a user