implement ldap mailbox get

This commit is contained in:
Girish Ramakrishnan
2016-09-25 16:45:51 -07:00
parent c158548c19
commit 4b34f823a7
2 changed files with 7 additions and 16 deletions
+6 -3
View File
@@ -130,9 +130,12 @@ function groupSearch(req, res, next) {
});
}
function mailboxSearch(req, res, next) {
debug('mailbox search: dn %s, scope %s, filter %s (from %s)', req.dn.toString(), req.scope, req.filter.toString(), req.connection.ldap.id);
function getMailbox(req, res, next) {
debug('mailbox get: dn %s, scope %s, filter %s (from %s)', req.dn.toString(), req.scope, req.filter.toString(), req.connection.ldap.id);
if (!req.dn.rdns[0].attrs.cn) return next(new ldap.OperationsError('CN is required'));
mailboxes.get(
mailboxes.getAll(function (error, result) {
if (error) return next(new ldap.OperationsError(error.toString()));
@@ -251,7 +254,7 @@ function start(callback) {
gServer.search('ou=groups,dc=cloudron', groupSearch);
gServer.bind('ou=users,dc=cloudron', authenticateUser, authorizeUserForApp);
gServer.search('ou=mailboxes,dc=cloudron', mailboxSearch);
gServer.search('ou=mailboxes,dc=cloudron', getMailbox);
gServer.bind('ou=mailboxes,dc=cloudron', authenticateUser, authorizeUserForMailbox);
// this is the bind for addons (after bind, they might search and authenticate)