fix(plugin-acl): pm.acl.roles snippet (#4026)

This commit is contained in:
ChengLei Shao 2024-04-12 16:03:09 +08:00 committed by GitHub
parent d4b4391aba
commit 2a31de8ce6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -60,7 +60,7 @@ describe('snippet', () => {
values: {
name: 'testRole',
strategy: { actions: ['view'] },
snippets: ['pm', 'pm.*'],
snippets: ['pm.acl.roles'],
},
});
@ -78,4 +78,22 @@ describe('snippet', () => {
expect(getResp.statusCode).toEqual(200);
});
it('should allow to get roles dataSourceCollections', async () => {
await app.db.getRepository('roles').create({
values: {
name: 'testRole',
strategy: {},
snippets: ['pm.acl.roles'],
},
});
const canRes = app.acl.can({
role: 'testRole',
action: 'list',
resource: 'roles.dataSourcesCollections',
});
expect(canRes).toBeTruthy();
});
});

View File

@ -181,6 +181,8 @@ export class PluginACLServer extends Plugin {
'roles.menuUiSchemas:*',
'roles.users:*',
'dataSources.roles:*',
'roles.dataSourcesCollections:*',
'roles.dataSourceResources:*',
],
});