Add user table to manage mailboxes per domain
This does not yet handle the aliases
This commit is contained in:
@@ -88,25 +88,18 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
$scope.mailboxes = {
|
||||
users: [],
|
||||
|
||||
enable: function (user) {
|
||||
submit: function (user) {
|
||||
user.busy = true;
|
||||
|
||||
Client.enableUserMailbox($scope.selectedDomain.domain, user.id, function (error) {
|
||||
var func = user.mailboxEnabled ? Client.enableUserMailbox : Client.disableUserMailbox;
|
||||
func($scope.selectedDomain.domain, user.id, function (error) {
|
||||
if (error) console.error(error);
|
||||
|
||||
user.busy = false;
|
||||
user.mailboxEnabled = error ? false : true;
|
||||
});
|
||||
},
|
||||
|
||||
disable: function (user) {
|
||||
user.busy = true;
|
||||
|
||||
Client.disableUserMailbox($scope.selectedDomain.domain, user.id, function (error) {
|
||||
if (error) console.error(error);
|
||||
// reset the dirty state
|
||||
user.orig.mailboxEnabled = user.mailboxEnabled;
|
||||
user.orig.aliases = user.aliases;
|
||||
|
||||
user.busy = false;
|
||||
user.mailboxEnabled = error ? true : false;
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -314,6 +307,12 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
var enabledUsers = mailboxes.map(function (m) { return m.name; });
|
||||
$scope.mailboxes.users = $scope.users.filter(function (u) { return !!u.username; }).map(function (u) {
|
||||
u.mailboxEnabled = (enabledUsers.indexOf(u.username) !== -1);
|
||||
u.aliases = 'well, hello, there';
|
||||
|
||||
u.orig = {};
|
||||
u.orig.mailboxEnabled = u.mailboxEnabled;
|
||||
u.orig.aliases = u.aliases;
|
||||
|
||||
return u;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user