diff --git a/packages/app/src/api/index.ts b/packages/app/src/api/index.ts index 967bafb6f..d5517d650 100644 --- a/packages/app/src/api/index.ts +++ b/packages/app/src/api/index.ts @@ -119,6 +119,26 @@ api.registerPlugin('plugin-file-manager', [path.resolve(__dirname, '../../../plu (async () => { await api.loadPlugins(); + + api.resourcer.use(async (ctx, next) => { + if (process.env.NOCOBASE_ENV !== 'demo') { + return next(); + } + const currentUser = ctx.state.currentUser; + if (currentUser && currentUser.username === 'admin') { + return next(); + } + const { actionName } = ctx.action.params; + if (['create', 'update', 'destroy'].includes(actionName)) { + ctx.body = { + data: {}, + meta: {}, + }; + return; + } + await next(); + }); + await api.database.getModel('collections').load({skipExisting: true}); api.listen(process.env.HTTP_PORT, () => { console.log(`http://localhost:${process.env.HTTP_PORT}/`); diff --git a/packages/plugin-collections/src/actions/getView.ts b/packages/plugin-collections/src/actions/getView.ts index 76cb5d788..bd713f356 100644 --- a/packages/plugin-collections/src/actions/getView.ts +++ b/packages/plugin-collections/src/actions/getView.ts @@ -18,7 +18,7 @@ export default async (ctx, next) => { const fields = await collection.getFields(); const actions = await collection.getActions(); const actionNames = view.options.actionNames||[]; - console.log(view.options); + // console.log(view.options); if (view.type === 'table') { const defaultTabs = await collection.getTabs({ where: { diff --git a/packages/plugin-collections/src/collections/views.ts b/packages/plugin-collections/src/collections/views.ts index d9e41f602..4e4e8a334 100644 --- a/packages/plugin-collections/src/collections/views.ts +++ b/packages/plugin-collections/src/collections/views.ts @@ -223,7 +223,7 @@ export default { interface: 'radio', type: 'virtual', name: 'defaultPerPage', - title: '每页显示几行数据', + title: '默认每页显示几行数据', defaultValue: 50, dataSource: [ {label: '10', value: 10}, diff --git a/packages/plugin-pages/src/actions/getView.ts b/packages/plugin-pages/src/actions/getView.ts index e5b2b4b78..0d78c3b28 100644 --- a/packages/plugin-pages/src/actions/getView.ts +++ b/packages/plugin-pages/src/actions/getView.ts @@ -291,7 +291,7 @@ export default async (ctx, next) => { } if (field.get('interface') === 'subTable') { const children = await field.getChildren(); - console.log(children); + // console.log(children); for (const child of children) { if (!['subTable', 'linkTo', 'attachment', 'updatedBy', 'createdBy'].includes(child.get('interface'))) { continue;