Disabled mirage member routes permission checks

refs 258f56ded9

- `@ember/test-helpers` is not included outside of test builds but we load mirage in development too so this was causing import errors that completely broke the app in development
- commented out the checks for now to get development working again whilst we look for alternatives to `getContext()`
This commit is contained in:
Kevin Ansfield 2022-10-03 13:12:08 +01:00
parent 04621b1e2e
commit 568e4183e3

View File

@ -3,21 +3,23 @@ import moment from 'moment-timezone';
import nql from '@tryghost/nql';
import {Response} from 'miragejs';
import {extractFilterParam, paginateModelCollection} from '../utils';
import {getContext} from '@ember/test-helpers';
// import {getContext} from '@ember/test-helpers';
import {underscore} from '@ember/string';
function hasInvalidPermissions() {
const {owner} = getContext();
const session = owner.lookup('service:session');
return false;
if (!session?.user?.isAdmin) {
return new Response(403, {}, {
errors: [{
type: 'NoPermissionError',
message: 'You do not have permission to perform this action'
}]
});
}
// const {owner} = getContext(this);
// const session = owner.lookup('service:session');
// if (!session?.user?.isAdmin) {
// return new Response(403, {}, {
// errors: [{
// type: 'NoPermissionError',
// message: 'You do not have permission to perform this action'
// }]
// });
// }
}
function withPermissionsCheck(fn) {