fix: attachment collection permission (#4470)

This commit is contained in:
ChengLei Shao 2024-05-23 19:50:24 +08:00 committed by GitHub
parent 0dd3ea8d2e
commit aa1ed6737d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -116,7 +116,7 @@ export interface CollectionOptions extends Omit<ModelOptions, 'name' | 'hooks'>
* - 'user' - collection is from user
*/
origin?: string;
asStrategyResource?: boolean;
[key: string]: any;
}

View File

@ -580,13 +580,13 @@ export class PluginACLServer extends Plugin {
);
this.db.on('afterUpdateCollection', async (collection) => {
if (collection.options.loadedFromCollectionManager) {
if (collection.options.loadedFromCollectionManager || collection.options.asStrategyResource) {
this.app.acl.appendStrategyResource(collection.name);
}
});
this.db.on('afterDefineCollection', async (collection) => {
if (collection.options.loadedFromCollectionManager) {
if (collection.options.loadedFromCollectionManager || collection.options.asStrategyResource) {
this.app.acl.appendStrategyResource(collection.name);
}
});

View File

@ -13,6 +13,7 @@ export default defineCollection({
dumpRules: {
group: 'user',
},
asStrategyResource: true,
shared: true,
name: 'attachments',
createdBy: true,