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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue