diff --git a/client/src/root.js b/client/src/root.js
index f6e3dfea..87944375 100644
--- a/client/src/root.js
+++ b/client/src/root.js
@@ -28,10 +28,10 @@ import {getUrl} from "./lib/urls";
import {withComponentMixins} from "./lib/decorator-helpers";
import Update from "./settings/Update";
-const topLevelMenuKeys = ['lists', 'channels', 'templates', 'campaigns'];
+const topLevelMenuKeys = ['Lists', 'Channels', 'Templates', 'Campaigns'];
if (mailtrainConfig.reportsEnabled) {
- topLevelMenuKeys.push('reports');
+ topLevelMenuKeys.push('Reports');
}
@@ -67,29 +67,38 @@ class Root extends Component {
const topLevelMenu = [];
- for (const entryKey of topLevelMenuKeys) {
- const entry = topLevelItems[entryKey];
- const link = entry.link || entry.externalLink;
-
- if (link && path.startsWith(link)) {
- topLevelMenu.push({entry.title} {t('current')});
- } else {
- topLevelMenu.push({entry.title});
- }
- }
-
if (mailtrainConfig.isAuthenticated) {
+
+ for (const entryKey of topLevelMenuKeys) {
+ const entry = topLevelItems[entryKey.toLowerCase()];
+ const link = entry.link || entry.externalLink;
+
+ if (mailtrainConfig.user.admin || mailtrainConfig.globalPermissions["manage"+entryKey]) {
+ if (link && path.startsWith(link)) {
+ topLevelMenu.push({entry.title} {t('current')});
+ } else {
+ topLevelMenu.push({entry.title});
+ }
+ }
+ }
+
return (
<>
{topLevelMenu}
- {mailtrainConfig.globalPermissions.displayManageUsers && {t('users')}}
- {t('namespaces')}
- {mailtrainConfig.globalPermissions.manageSettings && {t('globalSettings')}}
- {t('sendConfigurations')}
- {mailtrainConfig.globalPermissions.manageBlacklist && {t('blacklist')}}
- {t('api')}
+ {(mailtrainConfig.user.admin || mailtrainConfig.globalPermissions.manageUsers) &&
+ {t('users')}}
+ {(mailtrainConfig.user.admin || mailtrainConfig.globalPermissions.manageNamespaces) &&
+ {t('namespaces')}}
+ {(mailtrainConfig.user.admin || mailtrainConfig.globalPermissions.manageSettings) &&
+ {t('globalSettings')}}
+ {(mailtrainConfig.user.admin || mailtrainConfig.globalPermissions.manageSendConfigurations) &&
+ {t('sendConfigurations')}}
+ {(mailtrainConfig.user.admin || mailtrainConfig.globalPermissions.manageBlacklist) &&
+ {t('blacklist')}}
+ {(mailtrainConfig.user.admin || mailtrainConfig.globalPermissions.manageApi) &&
+ {t('api')}}
@@ -101,6 +110,7 @@ class Root extends Component {
>
);
+
} else {
return (
<>
diff --git a/server/config/default.yaml b/server/config/default.yaml
index 14b07bf9..037bf9e3 100644
--- a/server/config/default.yaml
+++ b/server/config/default.yaml
@@ -277,12 +277,12 @@ defaultRoles:
name: Global Master
admin: true
description: All permissions
- permissions: [rebuildPermissions, createJavascriptWithROAccess, displayManageUsers, manageBlacklist, manageSettings, setupAutomation]
+ permissions: [rebuildPermissions, createJavascriptWithROAccess, manageUsers, manageBlacklist, manageSettings, setupAutomation]
rootNamespaceRole: master
campaignsAdmin:
name: Campaigns Admin
description: Under the namespace in which the user is located, the user has all permissions for managing lists, templates and campaigns and the permission to send to send configurations.
- permissions: [setupAutomation]
+ permissions: [setupAutomation, manageLists, manageChannels, manageTemplates, manageCampaigns, manageReports, manageApi, manageSendConfigurations, manageNamespaces]
ownNamespaceRole: campaignsAdmin
campaignsAdminWithoutNamespace:
name: Campaigns Admin (multiple namespaces)
diff --git a/server/lib/client-helpers.js b/server/lib/client-helpers.js
index 2e61b332..f0e8d57b 100644
--- a/server/lib/client-helpers.js
+++ b/server/lib/client-helpers.js
@@ -40,7 +40,8 @@ async function getAuthenticatedConfig(context) {
user: {
id: context.user.id,
username: context.user.username,
- namespace: context.user.namespace
+ namespace: context.user.namespace,
+ admin: (config.roles.global[context.user.role]["admin"] || false)
},
globalPermissions,
editors: config.editors,