Commit 052536de authored by Patricio Bruna's avatar Patricio Bruna

Merge pull request #119 from ZBoxApp/fix_count_accounts_for_domain

Fix count accounts for domain admin
parents a1df6d64 5330aafa
......@@ -127,7 +127,7 @@
"consistent-this": [2, "self"],
"func-names": 2,
"func-style": [2, "declaration"],
"indent": [2, 4, {"SwitchCase": 0}],
# "indent": [2, 2, {"SwitchCase": 0}],
"jsx-quotes": [2, "prefer-single"],
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
"linebreak-style": 2,
......
{
"esnext": true,
"node": true,
"predef": [ "describe", "it", "beforeEach", "afterEach" ]
}
module.exports = {"main":{"js":"/950474bundle.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';
......@@ -586,28 +587,37 @@ export function batchRequest(requestArray, success, error) {
}
export function getAllCos(success, error) {
initZimbra().then(
(zimbra) => {
zimbra.getAllCos((err, data) => {
if (err) {
const e = handleError('getAllCos', err);
if (error) {
return error(e);
}
}
return success(data);
});
},
(err) => {
const e = handleError('getAllCos', err);
if (error) {
return error(e);
}
initZimbra().then(
(zimbra) => {
if (UserStore.isGlobalAdmin()) {
zimbra.getAllCos((err, data) => {
if (err) {
return error(handleError('getAllCos', err));
}
return success(data);
});
} else {
const batchRequests = [];
const planNames = Object.keys(window.manager_config.plans);
planNames.forEach((plan) => {
batchRequests.push(zimbra.getCos(plan));
});
return null;
}
);
zimbra.makeBatchRequest(batchRequests, (err, data) => {
if (err) {
return error(handleError('getCos', err));
}
const allCos = data.GetCosResponse.map((r) => {
return r.cos[0];
});
return success(allCos);
});
}
},
(err) => {
return error(handleError('getAllCos', err));
}
);
}
export function getAllDistributionLists(query, success, error) {
......
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