Skip to content

Commit

Permalink
fix: attachment collection permission (#4470)
Browse files Browse the repository at this point in the history
  • Loading branch information
chareice committed May 23, 2024
1 parent 0dd3ea8 commit aa1ed67
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/database/src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export interface CollectionOptions extends Omit<ModelOptions, 'name' | 'hooks'>
* - 'user' - collection is from user
*/
origin?: string;

asStrategyResource?: boolean;
[key: string]: any;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/@nocobase/plugin-acl/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default defineCollection({
dumpRules: {
group: 'user',
},
asStrategyResource: true,
shared: true,
name: 'attachments',
createdBy: true,
Expand Down

0 comments on commit aa1ed67

Please sign in to comment.