Add optional mailbox support

This commit is contained in:
Girish Ramakrishnan
2021-03-16 22:38:59 -07:00
parent 4cba5ca405
commit 9960729d6b
7 changed files with 39 additions and 9 deletions
+10 -5
View File
@@ -411,7 +411,7 @@ function removeInternalFields(app) {
'location', 'domain', 'fqdn', 'mailboxName', 'mailboxDomain',
'accessRestriction', 'manifest', 'portBindings', 'iconUrl', 'memoryLimit', 'cpuShares',
'sso', 'debugMode', 'reverseProxyConfig', 'enableBackup', 'creationTime', 'updateTime', 'ts', 'tags',
'label', 'alternateDomains', 'aliasDomains', 'env', 'enableAutomaticUpdate', 'dataDir', 'mounts');
'label', 'alternateDomains', 'aliasDomains', 'env', 'enableAutomaticUpdate', 'dataDir', 'mounts', 'enableMailbox');
}
// non-admins can only see these
@@ -1079,13 +1079,18 @@ function setDebugMode(app, debugMode, auditSource, callback) {
});
}
function setMailbox(app, mailboxName, mailboxDomain, auditSource, callback) {
function setMailbox(app, data, auditSource, callback) {
assert.strictEqual(typeof app, 'object');
assert(mailboxName === null || typeof mailboxName === 'string');
assert.strictEqual(typeof mailboxDomain, 'string');
assert.strictEqual(typeof data, 'object');
assert.strictEqual(typeof auditSource, 'object');
assert.strictEqual(typeof callback, 'function');
const { enable, mailboxDomain } = data;
let mailboxName = data.mailboxName;
assert.strictEqual(typeof enable, 'boolean');
assert(mailboxName === null || typeof mailboxName === 'string');
assert.strictEqual(typeof mailboxDomain, 'string');
const appId = app.id;
let error = checkAppState(app, exports.ISTATE_PENDING_RECREATE_CONTAINER);
if (error) return callback(error);
@@ -1104,7 +1109,7 @@ function setMailbox(app, mailboxName, mailboxDomain, auditSource, callback) {
const task = {
args: {},
values: { mailboxName, mailboxDomain }
values: { enableMailbox: enable, mailboxName, mailboxDomain }
};
addTask(appId, exports.ISTATE_PENDING_RECREATE_CONTAINER, task, function (error, result) {
if (error) return callback(error);