Commit bedfce6f authored by Patricio Bruna's avatar Patricio Bruna

fix Domain Cos Limit for Domain Admin

parent c91a1da8
{
"esnext": true,
"node": true,
"predef": [ "describe", "it", "beforeEach", "afterEach" ]
}
module.exports = {"main":{"js":"/228419bundle.js"}}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import ZimbraAdminApi from 'zimbra-admin-api-js';
import Powerdns from 'js-powerdns';
import ZimbraStore from '../stores/zimbra_store.jsx';
import ResetStores from '../stores/reset_stores.jsx';
import UserStore from '../stores/user_store.jsx';
import * as GlobalActions from '../action_creators/global_actions.jsx';
import * as Utils from './utils.jsx';
......@@ -588,16 +589,34 @@ export function batchRequest(requestArray, success, error) {
export function getAllCos(success, error) {
initZimbra().then(
(zimbra) => {
zimbra.getAllCos((err, data) => {
if (UserStore.isGlobalAdmin()) {
zimbra.getAllCos((err, data) => {
if (err) {
const e = handleError('getAllCos', err);
if (error) {
return error(e);
}
}
return success(data);
});
} else {
const batchRequests = [];
const plans_names = Object.keys(window.manager_config.plans);
plans_names.forEach((plan) => {
batchRequests.push(zimbra.getCos(plan));
});
zimbra.makeBatchRequest(batchRequests, (err, data) => {
if (err) {
const e = handleError('getAllCos', err);
const e = handleError('getCos', err);
if (error) {
return error(e);
}
}
return success(data);
});
return success(data.GetCosResponse.map((r) => {return r.cos[0];}));
});
}
},
(err) => {
const e = handleError('getAllCos', err);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment