chore: move collection manager snippets into data source (#3666)

This commit is contained in:
ChengLei Shao 2024-03-10 09:57:14 +08:00 committed by GitHub
parent 9e88972ba6
commit a477facdbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 7 deletions

View File

@ -31,7 +31,7 @@ class SnippetManager {
const snippet = this.snippets.get(snippetName);
if (!snippet) {
throw new Error(`Snippet ${snippetName} not found`);
return null;
}
const matched = snippet.actions.some((action) => minimatch(actionPath, action));

View File

@ -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) => {
if (this.app.db.inDialect('postgres') && this.schema && model.get('from') != 'db2cm' && !model.get('schema')) {
model.set('schema', this.schema);

View File

@ -472,7 +472,15 @@ export class PluginDataSourceManagerServer extends Plugin {
this.app.acl.registerSnippet({
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');