Complete client side
This commit is contained in:
parent
555f7a16f1
commit
d6308e53d5
14 changed files with 81 additions and 8 deletions
|
@ -10,6 +10,7 @@ import {Button} from '../lib/bootstrap-components';
|
||||||
import {getUrl} from "../lib/urls";
|
import {getUrl} from "../lib/urls";
|
||||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||||
import styles from "./styles.scss"
|
import styles from "./styles.scss"
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -35,6 +36,10 @@ export default class API extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageApi) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageApi');
|
||||||
|
}
|
||||||
// noinspection JSIgnoredPromiseFromCall
|
// noinspection JSIgnoredPromiseFromCall
|
||||||
this.loadAccessToken();
|
this.loadAccessToken();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {Button} from "../lib/bootstrap-components";
|
||||||
import {HTTPMethod} from "../lib/axios";
|
import {HTTPMethod} from "../lib/axios";
|
||||||
import {tableAddRestActionButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
|
import {tableAddRestActionButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
|
||||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -87,6 +88,10 @@ export default class List extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageBlacklist) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageBlacklist');
|
||||||
|
}
|
||||||
this.clearFields();
|
this.clearFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ import {getCampaignLabels, ListsSelectorHelper} from "./helpers";
|
||||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||||
import interoperableErrors from "../../../shared/interoperable-errors";
|
import interoperableErrors from "../../../shared/interoperable-errors";
|
||||||
import {Trans} from "react-i18next";
|
import {Trans} from "react-i18next";
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -254,6 +255,10 @@ export default class CUD extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageCampaigns) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageCampaigns');
|
||||||
|
}
|
||||||
if (this.props.entity) {
|
if (this.props.entity) {
|
||||||
this.getFormValuesFromEntity(this.props.entity);
|
this.getFormValuesFromEntity(this.props.entity);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRe
|
||||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||||
import styles from "./styles.scss";
|
import styles from "./styles.scss";
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -34,6 +35,13 @@ export default class List extends Component {
|
||||||
tableRestActionDialogInit(this);
|
tableRestActionDialogInit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageCampaigns) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageCampaigns');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
permissions: PropTypes.object,
|
permissions: PropTypes.object,
|
||||||
channel: PropTypes.object
|
channel: PropTypes.object
|
||||||
|
|
|
@ -32,6 +32,7 @@ import styles from "../../lib/styles.scss";
|
||||||
import 'ace-builds/src-noconflict/mode-json';
|
import 'ace-builds/src-noconflict/mode-json';
|
||||||
import 'ace-builds/src-noconflict/mode-handlebars';
|
import 'ace-builds/src-noconflict/mode-handlebars';
|
||||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -178,6 +179,10 @@ export default class CUD extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||||
|
}
|
||||||
if (this.props.entity) {
|
if (this.props.entity) {
|
||||||
this.getFormValuesFromEntity(this.props.entity);
|
this.getFormValuesFromEntity(this.props.entity);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {getFieldTypes} from './helpers';
|
||||||
import {Icon} from "../../lib/bootstrap-components";
|
import {Icon} from "../../lib/bootstrap-components";
|
||||||
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
|
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
|
||||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -32,6 +33,10 @@ export default class List extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import listStyles from "../styles.scss";
|
||||||
import styles from "../../lib/styles.scss";
|
import styles from "../../lib/styles.scss";
|
||||||
import interoperableErrors from "../../../../shared/interoperable-errors";
|
import interoperableErrors from "../../../../shared/interoperable-errors";
|
||||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
|
|
||||||
function truncate(str, len, ending = '...') {
|
function truncate(str, len, ending = '...') {
|
||||||
|
@ -209,6 +210,10 @@ export default class CUD extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||||
|
}
|
||||||
if (this.props.entity) {
|
if (this.props.entity) {
|
||||||
this.initFromEntity(this.props.entity);
|
this.initFromEntity(this.props.entity);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import moment from "moment";
|
||||||
import {inProgress} from '../../../../shared/imports';
|
import {inProgress} from '../../../../shared/imports';
|
||||||
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
|
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
|
||||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -37,6 +38,10 @@ export default class List extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import {getRuleHelpers} from "./helpers";
|
||||||
import RuleSettingsPane from "./RuleSettingsPane";
|
import RuleSettingsPane from "./RuleSettingsPane";
|
||||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||||
import clone from "clone";
|
import clone from "clone";
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
// https://stackoverflow.com/a/4819886/1601953
|
// https://stackoverflow.com/a/4819886/1601953
|
||||||
const isTouchDevice = !!('ontouchstart' in window || navigator.maxTouchPoints);
|
const isTouchDevice = !!('ontouchstart' in window || navigator.maxTouchPoints);
|
||||||
|
@ -123,6 +124,10 @@ export default class CUD extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||||
|
}
|
||||||
if (this.props.entity) {
|
if (this.props.entity) {
|
||||||
this.getFormValuesFromEntity(this.props.entity);
|
this.getFormValuesFromEntity(this.props.entity);
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {Table} from '../../lib/table';
|
||||||
import {Icon} from "../../lib/bootstrap-components";
|
import {Icon} from "../../lib/bootstrap-components";
|
||||||
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
|
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
|
||||||
import {withComponentMixins} from "../../lib/decorator-helpers";
|
import {withComponentMixins} from "../../lib/decorator-helpers";
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -29,6 +30,10 @@ export default class List extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageLists) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageLists');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -91,6 +91,10 @@ export default class CUD extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageSendConfigurations) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageSendConfigurations');
|
||||||
|
}
|
||||||
if (this.props.entity) {
|
if (this.props.entity) {
|
||||||
this.getFormValuesFromEntity(this.props.entity);
|
this.getFormValuesFromEntity(this.props.entity);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {getMailerTypes} from './helpers';
|
||||||
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
|
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
|
||||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
|
@ -33,6 +34,13 @@ export default class List extends Component {
|
||||||
permissions: PropTypes.object
|
permissions: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageSendConfigurations) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageSendConfigurations');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const t = this.props.t;
|
const t = this.props.t;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import {
|
||||||
} from '../lib/form';
|
} from '../lib/form';
|
||||||
import {withErrorHandling} from '../lib/error-handling';
|
import {withErrorHandling} from '../lib/error-handling';
|
||||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||||
|
import mailtrainConfig from 'mailtrainConfig';
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -45,6 +46,10 @@ export default class Update extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const t = this.props.t;
|
||||||
|
if (!mailtrainConfig.globalPermissions.manageSettings) {
|
||||||
|
this.navigateToWithFlashMessage('/', 'danger', t('permissionDenied')+': manageSettings');
|
||||||
|
}
|
||||||
this.getFormValuesFromEntity(this.props.entity);
|
this.getFormValuesFromEntity(this.props.entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ async function _validateAndPreprocess(tx, entity, isCreate) {
|
||||||
|
|
||||||
|
|
||||||
async function create(context, entity) {
|
async function create(context, entity) {
|
||||||
|
shares.enforceGlobalPermission(context, 'manageSendConfigurations');
|
||||||
return await knex.transaction(async tx => {
|
return await knex.transaction(async tx => {
|
||||||
await shares.enforceEntityPermissionTx(tx, context, 'namespace', entity.namespace, 'createSendConfiguration');
|
await shares.enforceEntityPermissionTx(tx, context, 'namespace', entity.namespace, 'createSendConfiguration');
|
||||||
|
|
||||||
|
@ -138,6 +139,7 @@ async function create(context, entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateWithConsistencyCheck(context, entity) {
|
async function updateWithConsistencyCheck(context, entity) {
|
||||||
|
shares.enforceGlobalPermission(context, 'manageSendConfigurations');
|
||||||
await knex.transaction(async tx => {
|
await knex.transaction(async tx => {
|
||||||
await shares.enforceEntityPermissionTx(tx, context, 'sendConfiguration', entity.id, 'edit');
|
await shares.enforceEntityPermissionTx(tx, context, 'sendConfiguration', entity.id, 'edit');
|
||||||
|
|
||||||
|
@ -167,6 +169,7 @@ async function updateWithConsistencyCheck(context, entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function remove(context, id) {
|
async function remove(context, id) {
|
||||||
|
shares.enforceGlobalPermission(context, 'manageSendConfigurations');
|
||||||
if (id === getSystemSendConfigurationId()) {
|
if (id === getSystemSendConfigurationId()) {
|
||||||
shares.throwPermissionDenied();
|
shares.throwPermissionDenied();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue