chore: move collection manager snippets into data source (#3666)
This commit is contained in:
parent
9e88972ba6
commit
a477facdbf
@ -31,7 +31,7 @@ class SnippetManager {
|
|||||||
const snippet = this.snippets.get(snippetName);
|
const snippet = this.snippets.get(snippetName);
|
||||||
|
|
||||||
if (!snippet) {
|
if (!snippet) {
|
||||||
throw new Error(`Snippet ${snippetName} not found`);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const matched = snippet.actions.some((action) => minimatch(actionPath, action));
|
const matched = snippet.actions.some((action) => minimatch(actionPath, action));
|
||||||
|
@ -51,11 +51,6 @@ export class CollectionManagerPlugin extends Plugin {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
this.app.acl.registerSnippet({
|
|
||||||
name: `pm.${this.name}.collections`,
|
|
||||||
actions: ['collections:*', 'collections.fields:*', 'dbViews:*', 'collectionCategories:*', 'sqlCollection:*'],
|
|
||||||
});
|
|
||||||
|
|
||||||
this.app.db.on('collections.beforeCreate', async (model) => {
|
this.app.db.on('collections.beforeCreate', async (model) => {
|
||||||
if (this.app.db.inDialect('postgres') && this.schema && model.get('from') != 'db2cm' && !model.get('schema')) {
|
if (this.app.db.inDialect('postgres') && this.schema && model.get('from') != 'db2cm' && !model.get('schema')) {
|
||||||
model.set('schema', this.schema);
|
model.set('schema', this.schema);
|
||||||
|
@ -472,7 +472,15 @@ export class PluginDataSourceManagerServer extends Plugin {
|
|||||||
|
|
||||||
this.app.acl.registerSnippet({
|
this.app.acl.registerSnippet({
|
||||||
name: `pm.${this.name}`,
|
name: `pm.${this.name}`,
|
||||||
actions: ['dataSources:*', 'roles.dataSourceResources'],
|
actions: [
|
||||||
|
'dataSources:*',
|
||||||
|
'roles.dataSourceResources',
|
||||||
|
'collections:*',
|
||||||
|
'collections.fields:*',
|
||||||
|
'dbViews:*',
|
||||||
|
'collectionCategories:*',
|
||||||
|
'sqlCollection:*',
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
this.app.acl.allow('dataSources', 'listEnabled', 'loggedIn');
|
this.app.acl.allow('dataSources', 'listEnabled', 'loggedIn');
|
||||||
|
Loading…
Reference in New Issue
Block a user