mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: attachment collection permission (#4470)
This commit is contained in:
parent
0dd3ea8d2e
commit
aa1ed6737d
@ -116,7 +116,7 @@ export interface CollectionOptions extends Omit<ModelOptions, 'name' | 'hooks'>
|
|||||||
* - 'user' - collection is from user
|
* - 'user' - collection is from user
|
||||||
*/
|
*/
|
||||||
origin?: string;
|
origin?: string;
|
||||||
|
asStrategyResource?: boolean;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,13 +580,13 @@ export class PluginACLServer extends Plugin {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.db.on('afterUpdateCollection', async (collection) => {
|
this.db.on('afterUpdateCollection', async (collection) => {
|
||||||
if (collection.options.loadedFromCollectionManager) {
|
if (collection.options.loadedFromCollectionManager || collection.options.asStrategyResource) {
|
||||||
this.app.acl.appendStrategyResource(collection.name);
|
this.app.acl.appendStrategyResource(collection.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.db.on('afterDefineCollection', async (collection) => {
|
this.db.on('afterDefineCollection', async (collection) => {
|
||||||
if (collection.options.loadedFromCollectionManager) {
|
if (collection.options.loadedFromCollectionManager || collection.options.asStrategyResource) {
|
||||||
this.app.acl.appendStrategyResource(collection.name);
|
this.app.acl.appendStrategyResource(collection.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -13,6 +13,7 @@ export default defineCollection({
|
|||||||
dumpRules: {
|
dumpRules: {
|
||||||
group: 'user',
|
group: 'user',
|
||||||
},
|
},
|
||||||
|
asStrategyResource: true,
|
||||||
shared: true,
|
shared: true,
|
||||||
name: 'attachments',
|
name: 'attachments',
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user