snappymail/dev/Storage/Admin/Remote.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
AbstractRemoteStorage = require('Storage/AbstractRemote')
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
*/
function RemoteAdminStorage()
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 = {};
}
_.extend(RemoteAdminStorage.prototype, AbstractRemoteStorage.prototype);
2014-08-20 23:03:12 +08:00
/**
* @param {?Function} fCallback
* @param {string} sLogin
* @param {string} sPassword
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.prototype.adminLogout = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminLogout');
};
/**
* @param {?Function} fCallback
* @param {?} oData
*/
RemoteAdminStorage.prototype.saveAdminConfig = function (fCallback, oData)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminSettingsUpdate', oData);
};
/**
* @param {?Function} fCallback
*/
RemoteAdminStorage.prototype.domainList = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminDomainList');
};
/**
* @param {?Function} fCallback
*/
RemoteAdminStorage.prototype.pluginList = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPluginList');
};
/**
* @param {?Function} fCallback
*/
RemoteAdminStorage.prototype.packagesList = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPackagesList');
};
/**
* @param {?Function} fCallback
*/
RemoteAdminStorage.prototype.coreData = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminCoreData');
};
/**
* @param {?Function} fCallback
*/
RemoteAdminStorage.prototype.updateCoreData = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
};
/**
* @param {?Function} fCallback
* @param {Object} oPackage
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.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
*/
RemoteAdminStorage.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'
});
};
RemoteAdminStorage.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
});
};
RemoteAdminStorage.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
*/
RemoteAdminStorage.prototype.testContacts = function (fCallback, oData)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminContactsTest', oData);
};
/**
* @param {?Function} fCallback
* @param {?} oData
*/
RemoteAdminStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPasswordUpdate', oData);
};
/**
* @param {?Function} fCallback
*/
RemoteAdminStorage.prototype.adminPing = function (fCallback)
2014-08-20 23:03:12 +08:00
{
this.defaultRequest(fCallback, 'AdminPing');
};
module.exports = new RemoteAdminStorage();
2014-08-20 23:03:12 +08:00
2014-09-05 06:49:03 +08:00
}());