fix: skip developer mode and internal collection permissions
This commit is contained in:
parent
22ce4c60e7
commit
4fb1ff6c33
@ -69,7 +69,7 @@ const transforms = {
|
||||
prop.type = 'string'
|
||||
}
|
||||
if (field.get('component.tooltip')) {
|
||||
prop.description = `{{html('${encodeURIComponent(field.get('component.tooltip'))}')}}`;
|
||||
// prop.description = `{{html('${encodeURIComponent(field.get('component.tooltip'))}')}}`;
|
||||
}
|
||||
if (field.get('name') === 'dataSource') {
|
||||
|
||||
@ -190,6 +190,11 @@ const transforms = {
|
||||
export default async (ctx, next) => {
|
||||
const { resourceName, resourceKey, values = {} } = ctx.action.params;
|
||||
const [View, Collection, Field, Action] = ctx.db.getModels(['views', 'collections', 'fields', 'actions']) as ModelCtor<Model>[];
|
||||
const collection = await Collection.findOne({
|
||||
where: {
|
||||
name: resourceName,
|
||||
},
|
||||
});
|
||||
let view = await View.findOne(View.parseApiJson({
|
||||
filter: {
|
||||
collection_name: resourceName,
|
||||
@ -201,7 +206,10 @@ export default async (ctx, next) => {
|
||||
}));
|
||||
let throughName;
|
||||
const { resourceKey: resourceKey2, associatedName, resourceFieldName, associatedKey } = values;
|
||||
const permissions = await ctx.ac.can(resourceName).permissions();
|
||||
// TODO: 暂时不处理 developerMode 和 internal 的情况
|
||||
const permissions = (ctx.ac.isRoot() || collection.developerMode || collection.internal)
|
||||
? await ctx.ac.getRootPermissions()
|
||||
: await ctx.ac.can(resourceName).permissions();
|
||||
ctx.listFields = [];
|
||||
ctx.createFields = [];
|
||||
ctx.updateFields = [];
|
||||
@ -239,11 +247,7 @@ export default async (ctx, next) => {
|
||||
// 如果不存在 view,新建一个
|
||||
view = new View({type: resourceKey, template: 'FilterForm'});
|
||||
}
|
||||
const collection = await Collection.findOne({
|
||||
where: {
|
||||
name: resourceName,
|
||||
},
|
||||
});
|
||||
|
||||
// const where: any = {
|
||||
// developerMode: ctx.state.developerMode,
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user