Use sync code in allow/deny for 2.x

This commit is contained in:
Harry Adel 2026-02-19 00:26:47 +02:00
parent f934aea2a5
commit e77be37450
28 changed files with 594 additions and 410 deletions

View file

@ -180,17 +180,17 @@ Lists.attachSchema(
);
Lists.allow({
async insert(userId, doc) {
insert(userId, doc) {
// ReadOnly and CommentOnly users cannot create lists
return allowIsBoardMemberWithWriteAccess(userId, await ReactiveCache.getBoard(doc.boardId));
return allowIsBoardMemberWithWriteAccess(userId, Boards.findOne(doc.boardId));
},
async update(userId, doc) {
update(userId, doc) {
// ReadOnly and CommentOnly users cannot edit lists
return allowIsBoardMemberWithWriteAccess(userId, await ReactiveCache.getBoard(doc.boardId));
return allowIsBoardMemberWithWriteAccess(userId, Boards.findOne(doc.boardId));
},
async remove(userId, doc) {
remove(userId, doc) {
// ReadOnly and CommentOnly users cannot delete lists
return allowIsBoardMemberWithWriteAccess(userId, await ReactiveCache.getBoard(doc.boardId));
return allowIsBoardMemberWithWriteAccess(userId, Boards.findOne(doc.boardId));
},
fetch: ['boardId'],
});
@ -540,7 +540,7 @@ Meteor.methods({
}
await Lists.updateAsync(
{ _id: listId, boardId },
listId,
{
$set: {
...updateData,