Merge a180d49612 into c3b968aa10
This commit is contained in:
commit
7f84cb81b1
38 changed files with 205 additions and 43 deletions
|
|
@ -10,6 +10,7 @@ import {Button} from '../lib/bootstrap-components';
|
|||
import {getUrl} from "../lib/urls";
|
||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import styles from "./styles.scss"
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -35,6 +36,10 @@ export default class API extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageApi) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageApi');
|
||||
}
|
||||
// noinspection JSIgnoredPromiseFromCall
|
||||
this.loadAccessToken();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {Button} from "../lib/bootstrap-components";
|
|||
import {HTTPMethod} from "../lib/axios";
|
||||
import {tableAddRestActionButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
|
||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -87,6 +88,10 @@ export default class List extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageBlacklist) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageBlacklist');
|
||||
}
|
||||
this.clearFields();
|
||||
}
|
||||
|
||||
|
|
@ -139,4 +144,4 @@ export default class List extends Component {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,6 +254,10 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageCampaigns) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageCampaigns');
|
||||
}
|
||||
if (this.props.entity) {
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRe
|
|||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import styles from "./styles.scss";
|
||||
import PropTypes from 'prop-types';
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -34,6 +35,13 @@ export default class List extends Component {
|
|||
tableRestActionDialogInit(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageCampaigns) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageCampaigns');
|
||||
}
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
permissions: PropTypes.object,
|
||||
channel: PropTypes.object
|
||||
|
|
|
|||
|
|
@ -254,6 +254,10 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageChannels) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageChannels');
|
||||
}
|
||||
if (this.props.entity) {
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRe
|
|||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import styles from "./styles.scss";
|
||||
import PropTypes from 'prop-types';
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -31,6 +32,13 @@ export default class List extends Component {
|
|||
permissions: PropTypes.object
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageChannels) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageChannels');
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const t = this.props.t;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import {FieldWizard, UnsubscriptionMode} from '../../../shared/lists';
|
|||
import styles from "../lib/styles.scss";
|
||||
import {getMailerTypes} from "../send-configurations/helpers";
|
||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -73,6 +74,10 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
if (this.props.entity) {
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRe
|
|||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import {withForm} from "../lib/form";
|
||||
import PropTypes from 'prop-types';
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -26,6 +27,13 @@ export default class List extends Component {
|
|||
tableRestActionDialogInit(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
permissions: PropTypes.object
|
||||
}
|
||||
|
|
@ -132,6 +140,7 @@ export default class List extends Component {
|
|||
|
||||
<Table ref={node => this.table = node} withHeader dataUrl="rest/lists-table" columns={columns} />
|
||||
</div>
|
||||
);
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import styles from "../../lib/styles.scss";
|
|||
import 'ace-builds/src-noconflict/mode-json';
|
||||
import 'ace-builds/src-noconflict/mode-handlebars';
|
||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -178,6 +179,10 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
if (this.props.entity) {
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {getFieldTypes} from './helpers';
|
|||
import {Icon} from "../../lib/bootstrap-components";
|
||||
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
|
||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -32,6 +33,10 @@ export default class List extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
@ -77,4 +82,4 @@ export default class List extends Component {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import listStyles from "../styles.scss";
|
|||
import styles from "../../lib/styles.scss";
|
||||
import interoperableErrors from "../../../../shared/interoperable-errors";
|
||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
|
||||
function truncate(str, len, ending = '...') {
|
||||
|
|
@ -209,6 +210,10 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
if (this.props.entity) {
|
||||
this.initFromEntity(this.props.entity);
|
||||
} else {
|
||||
|
|
@ -469,4 +474,4 @@ export default class CUD extends Component {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ export default class List extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
@ -95,4 +99,4 @@ export default class List extends Component {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import {getRuleHelpers} from "./helpers";
|
|||
import RuleSettingsPane from "./RuleSettingsPane";
|
||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||
import clone from "clone";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
// https://stackoverflow.com/a/4819886/1601953
|
||||
const isTouchDevice = !!('ontouchstart' in window || navigator.maxTouchPoints);
|
||||
|
|
@ -123,6 +124,10 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
if (this.props.entity) {
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
|
||||
|
|
@ -401,4 +406,4 @@ export default class CUD extends Component {
|
|||
</DndProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {Table} from '../../lib/table';
|
|||
import {Icon} from "../../lib/bootstrap-components";
|
||||
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
|
||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -29,6 +30,10 @@ export default class List extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
@ -69,4 +74,4 @@ export default class List extends Component {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import {getFieldColumn, SubscriptionStatus} from '../../../../shared/lists';
|
|||
import {getFieldTypes, getSubscriptionStatusLabels} from './helpers';
|
||||
import moment from 'moment-timezone';
|
||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -89,6 +90,11 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
|
||||
if (this.props.entity) {
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {
|
|||
} from "../../lib/modals";
|
||||
import listStyles from "../styles.scss";
|
||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -58,6 +59,10 @@ export default class List extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
this.populateFormValues({
|
||||
segment: this.props.segmentId || ''
|
||||
});
|
||||
|
|
@ -188,4 +193,4 @@ export default class List extends Component {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageNamespaces) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageNamespaces');
|
||||
}
|
||||
if (this.props.entity) {
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,12 @@ export default class List extends Component {
|
|||
static propTypes = {
|
||||
permissions: PropTypes.object
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageNamespaces) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageNamespaces');
|
||||
}
|
||||
}
|
||||
render() {
|
||||
const t = this.props.t;
|
||||
|
||||
|
|
|
|||
|
|
@ -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,30 +67,43 @@ 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(<NavLink key={entryKey} className="active" to={link}>{entry.title} <span className="sr-only">{t('current')}</span></NavLink>);
|
||||
} else {
|
||||
topLevelMenu.push(<NavLink key={entryKey} to={link}>{entry.title}</NavLink>);
|
||||
}
|
||||
}
|
||||
|
||||
if (mailtrainConfig.isAuthenticated) {
|
||||
|
||||
const gP = mailtrainConfig.globalPermissions;
|
||||
|
||||
for (const entryKey of topLevelMenuKeys) {
|
||||
const entry = topLevelItems[entryKey.toLowerCase()];
|
||||
const link = entry.link || entry.externalLink;
|
||||
|
||||
if (gP["manage"+entryKey]) {
|
||||
if (link && path.startsWith(link)) {
|
||||
topLevelMenu.push(<NavLink key={entryKey.toLowerCase()} className="active" to={link}>{entry.title} <span className="sr-only">{t('current')}</span></NavLink>);
|
||||
} else {
|
||||
topLevelMenu.push(<NavLink key={entryKey.toLowerCase()} to={link}>{entry.title}</NavLink>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ul className="navbar-nav mt-navbar-nav-left">
|
||||
{topLevelMenu}
|
||||
<NavDropdown label={t('administration')}>
|
||||
{mailtrainConfig.globalPermissions.displayManageUsers && <DropdownLink to="/users">{t('users')}</DropdownLink>}
|
||||
<DropdownLink to="/namespaces">{t('namespaces')}</DropdownLink>
|
||||
{mailtrainConfig.globalPermissions.manageSettings && <DropdownLink to="/settings">{t('globalSettings')}</DropdownLink>}
|
||||
<DropdownLink to="/send-configurations">{t('sendConfigurations')}</DropdownLink>
|
||||
{mailtrainConfig.globalPermissions.manageBlacklist && <DropdownLink to="/blacklist">{t('blacklist')}</DropdownLink>}
|
||||
<DropdownLink to="/account/api">{t('api')}</DropdownLink>
|
||||
</NavDropdown>
|
||||
{(gP.manageUsers || gP.manageNamespaces || gP.manageSettings ||
|
||||
gP.manageSendConfigurations || gP.manageBlacklist || gP.manageApi) &&
|
||||
<NavDropdown label={t('administration')}>
|
||||
{(gP.manageUsers) &&
|
||||
<DropdownLink to="/users">{t('users')}</DropdownLink>}
|
||||
{(gP.manageNamespaces) &&
|
||||
<DropdownLink to="/namespaces">{t('namespaces')}</DropdownLink>}
|
||||
{(gP.manageSettings) &&
|
||||
<DropdownLink to="/settings">{t('globalSettings')}</DropdownLink>}
|
||||
{(gP.manageSendConfigurations) &&
|
||||
<DropdownLink to="/send-configurations">{t('sendConfigurations')}</DropdownLink>}
|
||||
{(gP.manageBlacklist) &&
|
||||
<DropdownLink to="/blacklist">{t('blacklist')}</DropdownLink>}
|
||||
{(gP.manageApi) &&
|
||||
<DropdownLink to="/account/api">{t('api')}</DropdownLink>}
|
||||
</NavDropdown>}
|
||||
</ul>
|
||||
<ul className="navbar-nav mt-navbar-nav-right">
|
||||
{getLanguageChooser(t)}
|
||||
|
|
@ -101,6 +114,7 @@ class Root extends Component {
|
|||
</ul>
|
||||
</>
|
||||
);
|
||||
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -91,6 +91,10 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageSendConfigurations) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageSendConfigurations');
|
||||
}
|
||||
if (this.props.entity) {
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {getMailerTypes} from './helpers';
|
|||
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
|
||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import PropTypes from 'prop-types';
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
|
||||
@withComponentMixins([
|
||||
|
|
@ -33,6 +34,13 @@ export default class List extends Component {
|
|||
permissions: PropTypes.object
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageSendConfigurations) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageSendConfigurations');
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const t = this.props.t;
|
||||
|
||||
|
|
@ -87,4 +95,4 @@ export default class List extends Component {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import {
|
|||
} from '../lib/form';
|
||||
import {withErrorHandling} from '../lib/error-handling';
|
||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
|
@ -45,6 +46,10 @@ export default class Update extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.globalPermissions.manageSettings) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageSettings');
|
||||
}
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
}
|
||||
|
||||
|
|
@ -102,4 +107,4 @@ export default class Update extends Component {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue