snappymail/dev/Storages/AdminRemoteStorage.js

276 lines
6.2 KiB
JavaScript
Raw Normal View History

2014-08-20 23:03:12 +08:00
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
2014-09-05 06:49:03 +08:00
(function () {
2014-08-25 23:49:01 +08:00
'use strict';
2014-08-20 23:03:12 +08:00
var
2014-08-25 23:49:01 +08:00
_ = require('_'),
2014-08-25 15:10:51 +08:00
2014-08-27 23:59:44 +08:00
AbstractRemoteStorage = require('Storage:Abstract:Remote')
2014-08-20 23:03:12 +08:00
;
2014-08-25 15:10:51 +08:00
2014-08-20 23:03:12 +08:00
/**
* @constructor
2014-08-27 23:59:44 +08:00
* @extends AbstractRemoteStorage
2014-08-20 23:03:12 +08:00
*/
2014-08-27 23:59:44 +08:00
function AdminRemoteStorage()
2014-08-20 23:03:12 +08:00
{
2014-08-27 23:59:44 +08:00
AbstractRemoteStorage.call(this);
2014-08-20 23:03:12 +08:00
this.oRequests = {};
}
2014-08-27 23:59:44 +08:00
_.extend(AdminRemoteStorage.prototype, AbstractRemoteStorage.prototype);
2014-08-20 23:03:12 +08:00
/**
* @param {?Function} fCallback
* @param {string} sLogin
* @param {string} sPassword
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.adminLogin = function (fCallback, sLogin, sPassword)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminLogin', {
'Login': sLogin,
'Password': sPassword
});
};
/**
* @param {?Function} fCallback
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.adminLogout = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminLogout');
};
/**
* @param {?Function} fCallback
* @param {?} oData
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.saveAdminConfig = function (fCallback, oData)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminSettingsUpdate', oData);
};
/**
* @param {?Function} fCallback
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.domainList = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminDomainList');
};
/**
* @param {?Function} fCallback
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.pluginList = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPluginList');
};
/**
* @param {?Function} fCallback
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.packagesList = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPackagesList');
};
/**
* @param {?Function} fCallback
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.coreData = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminCoreData');
};
/**
* @param {?Function} fCallback
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.updateCoreData = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
};
/**
* @param {?Function} fCallback
* @param {Object} oPackage
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.packageInstall = function (fCallback, oPackage)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPackageInstall', {
'Id': oPackage.id,
'Type': oPackage.type,
'File': oPackage.file
}, 60000);
};
/**
* @param {?Function} fCallback
* @param {Object} oPackage
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.packageDelete = function (fCallback, oPackage)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPackageDelete', {
'Id': oPackage.id
});
};
/**
* @param {?Function} fCallback
* @param {string} sName
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.domain = function (fCallback, sName)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminDomainLoad', {
'Name': sName
});
};
/**
* @param {?Function} fCallback
* @param {string} sName
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.plugin = function (fCallback, sName)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPluginLoad', {
'Name': sName
});
};
/**
* @param {?Function} fCallback
* @param {string} sName
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.domainDelete = function (fCallback, sName)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminDomainDelete', {
'Name': sName
});
};
/**
* @param {?Function} fCallback
* @param {string} sName
* @param {boolean} bDisabled
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.domainDisable = function (fCallback, sName, bDisabled)
2014-08-20 23:03:12 +08:00
{
return this.defaultRequest(fCallback, 'AdminDomainDisable', {
'Name': sName,
'Disabled': !!bDisabled ? '1' : '0'
});
};
/**
* @param {?Function} fCallback
* @param {Object} oConfig
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.pluginSettingsUpdate = function (fCallback, oConfig)
2014-08-20 23:03:12 +08:00
{
return this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig);
};
/**
* @param {?Function} fCallback
* @param {boolean} bForce
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.licensing = function (fCallback, bForce)
2014-08-20 23:03:12 +08:00
{
return this.defaultRequest(fCallback, 'AdminLicensing', {
'Force' : bForce ? '1' : '0'
});
};
/**
* @param {?Function} fCallback
* @param {string} sDomain
* @param {string} sKey
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.licensingActivate = function (fCallback, sDomain, sKey)
2014-08-20 23:03:12 +08:00
{
return this.defaultRequest(fCallback, 'AdminLicensingActivate', {
'Domain' : sDomain,
'Key' : sKey
});
};
/**
* @param {?Function} fCallback
* @param {string} sName
* @param {boolean} bDisabled
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.pluginDisable = function (fCallback, sName, bDisabled)
2014-08-20 23:03:12 +08:00
{
return this.defaultRequest(fCallback, 'AdminPluginDisable', {
'Name': sName,
'Disabled': !!bDisabled ? '1' : '0'
});
};
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.createOrUpdateDomain = function (fCallback,
2014-08-20 23:03:12 +08:00
bCreate, sName, sIncHost, iIncPort, sIncSecure, bIncShortLogin,
sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, sWhiteList)
{
this.defaultRequest(fCallback, 'AdminDomainSave', {
'Create': bCreate ? '1' : '0',
'Name': sName,
'IncHost': sIncHost,
'IncPort': iIncPort,
'IncSecure': sIncSecure,
'IncShortLogin': bIncShortLogin ? '1' : '0',
'OutHost': sOutHost,
'OutPort': iOutPort,
'OutSecure': sOutSecure,
'OutShortLogin': bOutShortLogin ? '1' : '0',
'OutAuth': bOutAuth ? '1' : '0',
'WhiteList': sWhiteList
});
};
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.testConnectionForDomain = function (fCallback, sName,
2014-08-20 23:03:12 +08:00
sIncHost, iIncPort, sIncSecure,
sOutHost, iOutPort, sOutSecure, bOutAuth)
{
this.defaultRequest(fCallback, 'AdminDomainTest', {
'Name': sName,
'IncHost': sIncHost,
'IncPort': iIncPort,
'IncSecure': sIncSecure,
'OutHost': sOutHost,
'OutPort': iOutPort,
'OutSecure': sOutSecure,
'OutAuth': bOutAuth ? '1' : '0'
});
};
/**
* @param {?Function} fCallback
* @param {?} oData
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.testContacts = function (fCallback, oData)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminContactsTest', oData);
};
/**
* @param {?Function} fCallback
* @param {?} oData
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPasswordUpdate', oData);
};
/**
* @param {?Function} fCallback
*/
2014-08-27 23:59:44 +08:00
AdminRemoteStorage.prototype.adminPing = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPing');
};
2014-08-27 23:59:44 +08:00
module.exports = new AdminRemoteStorage();
2014-08-20 23:03:12 +08:00
2014-09-05 06:49:03 +08:00
}());