feat: plugin-disable-pm-add-online (#2918)
This commit is contained in:
parent
a1c425f733
commit
568b12a537
@ -0,0 +1,2 @@
|
|||||||
|
/node_modules
|
||||||
|
/src
|
2
packages/plugins/@nocobase/plugin-disable-pm-add/client.d.ts
vendored
Normal file
2
packages/plugins/@nocobase/plugin-disable-pm-add/client.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './dist/client';
|
||||||
|
export { default } from './dist/client';
|
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./dist/client/index.js');
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "@nocobase/plugin-disable-pm-add",
|
||||||
|
"version": "0.14.0-alpha.7",
|
||||||
|
"main": "./dist/server/index.js",
|
||||||
|
"peerDependencies": {
|
||||||
|
"@nocobase/client": "0.x",
|
||||||
|
"@nocobase/server": "0.x",
|
||||||
|
"@nocobase/test": "0.x"
|
||||||
|
},
|
||||||
|
"gitHead": "ee5825377d8bec05f968a8365a0cdcd49878ada6"
|
||||||
|
}
|
2
packages/plugins/@nocobase/plugin-disable-pm-add/server.d.ts
vendored
Normal file
2
packages/plugins/@nocobase/plugin-disable-pm-add/server.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './dist/server';
|
||||||
|
export { default } from './dist/server';
|
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./dist/server/index.js');
|
@ -0,0 +1,7 @@
|
|||||||
|
import { Plugin } from '@nocobase/client';
|
||||||
|
|
||||||
|
class PluginDisablePmAddClient extends Plugin {
|
||||||
|
async load() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PluginDisablePmAddClient;
|
@ -0,0 +1,2 @@
|
|||||||
|
export * from './server';
|
||||||
|
export { default } from './server';
|
@ -0,0 +1,27 @@
|
|||||||
|
import { InstallOptions, Plugin } from '@nocobase/server';
|
||||||
|
|
||||||
|
export class PluginDisablePmAddServer extends Plugin {
|
||||||
|
beforeLoad() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
async load() {
|
||||||
|
this.app.resourcer.use(async (ctx, next) => {
|
||||||
|
const { resourceName, actionName } = ctx.action;
|
||||||
|
if (resourceName === 'pm' && actionName === 'add') {
|
||||||
|
ctx.throw(403, 'The current environment does not allow adding plugins online');
|
||||||
|
}
|
||||||
|
await next();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async disable() {
|
||||||
|
// this.app.resourcer.removeResource('testHello');
|
||||||
|
}
|
||||||
|
|
||||||
|
async install(options: InstallOptions) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PluginDisablePmAddServer;
|
Loading…
Reference in New Issue
Block a user