add mail manager role

part of cloudron/box#807
This commit is contained in:
Girish Ramakrishnan
2021-12-02 09:29:33 -08:00
parent 141d9fe4a6
commit 2c5b3d2c07
5 changed files with 17 additions and 10 deletions
+3 -1
View File
@@ -5,7 +5,9 @@
/* global async */
angular.module('Application').controller('EmailController', ['$scope', '$location', '$translate', '$timeout', '$route', '$routeParams', 'Client', function ($scope, $location, $translate, $timeout, $route, $routeParams, Client) {
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastAdmin) $location.path('/'); });
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastMailManager) $location.path('/'); });
$scope.user = Client.getUserInfo();
// Avoid full reload on path change
// https://stackoverflow.com/a/22614334
+8 -6
View File
@@ -3,7 +3,7 @@
/* global $, angular, TASK_TYPES */
angular.module('Application').controller('EmailsController', ['$scope', '$location', '$translate', '$timeout', 'Client', function ($scope, $location, $translate, $timeout, Client) {
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastAdmin) $location.path('/'); });
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastMailManager) $location.path('/'); });
$scope.ready = false;
$scope.config = Client.getConfig();
@@ -409,11 +409,13 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
$scope.domains = domains;
$scope.ready = true;
$scope.mailLocation.refresh();
$scope.maxEmailSize.refresh();
$scope.spamConfig.refresh();
$scope.solrConfig.refresh();
$scope.acl.refresh();
if ($scope.user.isAtLeastOwner) {
$scope.mailLocation.refresh();
$scope.maxEmailSize.refresh();
$scope.spamConfig.refresh();
$scope.solrConfig.refresh();
$scope.acl.refresh();
}
refreshDomainStatuses();
});
+1
View File
@@ -979,6 +979,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
$scope.roles = [
{ id: 'user', name: $translate.instant('users.role.user'), disabled: false },
{ id: 'usermanager', name: $translate.instant('users.role.usermanager'), disabled: false },
{ id: 'mailmanager', name: $translate.instant('users.role.mailmanager'), disabled: false },
{ id: 'admin', name: $translate.instant('users.role.admin'), disabled: !$scope.user.isAtLeastAdmin },
{ id: 'owner', name: $translate.instant('users.role.owner'), disabled: !$scope.user.isAtLeastOwner }
];