diff --git a/src/views/users.js b/src/views/users.js index 2120012ab..300eb350b 100644 --- a/src/views/users.js +++ b/src/views/users.js @@ -1003,7 +1003,10 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio $scope.externalLdap.percent = 100; // indicates that 'result' is valid $scope.externalLdap.errorMessage = data.success ? '' : data.error.message; - return refreshUsers(); + refreshGroups(); + refreshUsers(); + + return; } $scope.externalLdap.syncBusy = true; @@ -1142,9 +1145,12 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio }); } - function refresh() { + function refreshGroups(callback) { Client.getGroups(function (error, result) { - if (error) return console.error('Unable to get group listing.', error); + if (error) { + if (callback) return callback(error); + else return console.error('Unable to get group listing.', error); + } angular.copy(result, $scope.groups); $scope.groupsById = { }; @@ -1152,6 +1158,13 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio $scope.groupsById[result[i].id] = result[i]; } + if (callback) callback(); + }); + } + + function refresh() { + refreshGroups(function (error) { + if (error) return console.error('Unable to get group listing.', error); refreshUsers(true); }); }