Remove enforces for getters
This commit is contained in:
parent
e244163bdb
commit
e8bad80e59
7 changed files with 7 additions and 13 deletions
|
@ -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,
|
||||
|
@ -117,6 +118,7 @@ export default class List extends Component {
|
|||
];
|
||||
|
||||
return (
|
||||
{(mailtrainConfig.user.admin || mailtrainConfig.globalPermissions.manageList) ?
|
||||
<div>
|
||||
{tableRestActionDialogRender(this)}
|
||||
<Toolbar>
|
||||
|
@ -132,6 +134,8 @@ 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>}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -230,7 +230,6 @@ async function listTestUsersDTAjax(context, campaignId, params) {
|
|||
}
|
||||
|
||||
async function _listSubscriberResultsDTAjax(context, campaignId, getSubsQrys, columns, params) {
|
||||
shares.enforceGlobalPermission(context, 'manageCampaigns');
|
||||
return await knex.transaction(async tx => {
|
||||
await shares.enforceEntityPermissionTx(tx, context, 'campaign', campaignId, 'view');
|
||||
|
||||
|
@ -325,7 +324,6 @@ async function listOpensDTAjax(context, campaignId, params) {
|
|||
}
|
||||
|
||||
async function listLinkClicksDTAjax(context, campaignId, params) {
|
||||
shares.enforceGlobalPermission(context, 'manageCampaigns');
|
||||
return await knex.transaction(async (tx) => {
|
||||
await shares.enforceEntityPermissionTx(tx, context, 'campaign', campaignId, 'viewStats');
|
||||
|
||||
|
@ -978,7 +976,6 @@ async function disable(context, campaignId) {
|
|||
|
||||
|
||||
async function getStatisticsOpened(context, id) {
|
||||
shares.enforceGlobalPermission(context, 'manageCampaigns');
|
||||
return await knex.transaction(async tx => {
|
||||
await shares.enforceEntityPermissionTx(tx, context, 'campaign', id, 'viewStats');
|
||||
|
||||
|
@ -993,7 +990,6 @@ async function getStatisticsOpened(context, id) {
|
|||
}
|
||||
|
||||
async function fetchRssCampaign(context, cid) {
|
||||
shares.enforceGlobalPermission(context, 'manageCampaigns');
|
||||
return await knex.transaction(async tx => {
|
||||
|
||||
const campaign = await tx('campaigns').where('cid', cid).select(['id', 'type']).first();
|
||||
|
|
|
@ -30,7 +30,6 @@ function hash(entity) {
|
|||
}
|
||||
|
||||
async function listDTAjax(context, params) {
|
||||
shares.enforceGlobalPermission(context, 'manageChannels');
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'channel', requiredOperations: ['view'] }],
|
||||
|
@ -96,7 +95,6 @@ async function _getByTx(tx, context, key, id, withPermissions = true) {
|
|||
}
|
||||
|
||||
async function getByIdTx(tx, context, id, withPermissions = true) {
|
||||
shares.enforceGlobalPermission(context, 'manageChannels');
|
||||
await shares.enforceEntityPermissionTx(tx, context, 'channel', id, 'view');
|
||||
|
||||
return await _getByTx(tx, context, 'id', id, withPermissions);
|
||||
|
|
|
@ -27,7 +27,6 @@ function hash(entity) {
|
|||
|
||||
|
||||
async function _listDTAjax(context, namespaceId, params) {
|
||||
shares.enforceGlobalPermission(context, 'manageLists');
|
||||
const campaignEntityType = entitySettings.getEntityType('campaign');
|
||||
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
|
|
|
@ -119,7 +119,6 @@ async function getById(context, id) {
|
|||
}
|
||||
|
||||
async function getChildrenTx(tx, context, id) {
|
||||
await shares.enforceEntityPermissionTx(tx, context, 'namespace', id, 'view');
|
||||
|
||||
const entityType = entitySettings.getEntityType('namespace');
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ function hash(entity) {
|
|||
}
|
||||
|
||||
async function getByIdWithTemplate(context, id, withPermissions = true) {
|
||||
shares.enforceGlobalPermission(context, 'manageReports');
|
||||
return await knex.transaction(async tx => {
|
||||
await shares.enforceEntityPermissionTx(tx, context, 'report', id, 'view');
|
||||
|
||||
|
@ -47,7 +46,6 @@ async function getByIdWithTemplate(context, id, withPermissions = true) {
|
|||
}
|
||||
|
||||
async function listDTAjax(context, params) {
|
||||
shares.enforceGlobalPermission(context, 'manageReports');
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[
|
||||
|
@ -142,6 +140,7 @@ async function remove(context, id) {
|
|||
}
|
||||
|
||||
async function updateFields(id, fields) {
|
||||
shares.enforceGlobalPermission(context, 'manageReports');
|
||||
return await knex('reports').where('id', id).update(fields);
|
||||
}
|
||||
|
||||
|
@ -150,6 +149,7 @@ async function listByState(state, limit) {
|
|||
}
|
||||
|
||||
async function bulkChangeState(oldState, newState) {
|
||||
shares.enforceGlobalPermission(context, 'manageReports');
|
||||
return await knex('reports').where('state', oldState).update('state', newState);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ function hash(entity) {
|
|||
}
|
||||
|
||||
async function _getByTx(tx, context, key, value, extraColumns = []) {
|
||||
shares.enforceGlobalPermission(context, 'manageUsers');
|
||||
const columns = ['id', 'username', 'name', 'email', 'namespace', 'role', ...extraColumns];
|
||||
|
||||
const user = await tx('users').select(columns).where(key, value).first();
|
||||
|
@ -110,7 +109,6 @@ async function serverValidate(context, data, isOwnAccount) {
|
|||
}
|
||||
|
||||
async function listDTAjax(context, params) {
|
||||
shares.enforceGlobalPermission(context, 'manageUsers');
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'namespace', requiredOperations: ['manageUsers'] }],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue