Avoid listing without permissions from client side
This commit is contained in:
parent
e8bad80e59
commit
564c0ce4f9
6 changed files with 39 additions and 5 deletions
|
@ -37,6 +37,7 @@ import {getCampaignLabels, ListsSelectorHelper} from "../campaigns/helpers";
|
|||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import interoperableErrors from "../../../shared/interoperable-errors";
|
||||
import {Trans} from "react-i18next";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
@ -254,6 +255,10 @@ export default class CUD extends Component {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.user.admin && !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.user.admin && !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.user.admin && !mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
if (this.props.entity) {
|
||||
this.getFormValuesFromEntity(this.props.entity);
|
||||
|
||||
|
|
|
@ -27,6 +27,13 @@ export default class List extends Component {
|
|||
tableRestActionDialogInit(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const t = this.props.t;
|
||||
if (!mailtrainConfig.user.admin && !mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
permissions: PropTypes.object
|
||||
}
|
||||
|
@ -118,7 +125,6 @@ export default class List extends Component {
|
|||
];
|
||||
|
||||
return (
|
||||
{(mailtrainConfig.user.admin || mailtrainConfig.globalPermissions.manageList) ?
|
||||
<div>
|
||||
{tableRestActionDialogRender(this)}
|
||||
<Toolbar>
|
||||
|
@ -134,8 +140,7 @@ export default class List extends Component {
|
|||
|
||||
<Table ref={node => this.table = node} withHeader dataUrl="rest/lists-table" columns={columns} />
|
||||
</div>
|
||||
:
|
||||
<div><h1>No tienes permisos para manejar listas</h1></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.user.admin && !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.user.admin && !mailtrainConfig.globalPermissions.manageLists) {
|
||||
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||
}
|
||||
this.populateFormValues({
|
||||
segment: this.props.segmentId || ''
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue