mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Fix files access bug
This commit is contained in:
parent
f9f529e53f
commit
f521b7949a
1 changed files with 6 additions and 12 deletions
|
@ -21,19 +21,13 @@ if (Meteor.isServer) {
|
|||
// We authorize the attachment download either:
|
||||
// - if the board is public, everyone (even unconnected) can download it
|
||||
// - if the board is private, only board members can download it
|
||||
//
|
||||
// XXX We have a bug with the `userId` verification:
|
||||
//
|
||||
// https://github.com/CollectionFS/Meteor-CollectionFS/issues/449
|
||||
//
|
||||
download(userId, doc) {
|
||||
const query = {
|
||||
$or: [
|
||||
{ 'members.userId': userId },
|
||||
{ permission: 'public' },
|
||||
],
|
||||
};
|
||||
return Boolean(Boards.findOne(doc.boardId, query));
|
||||
const board = Boards.findOne(doc.boardId);
|
||||
if (board.isPublic()) {
|
||||
return true;
|
||||
} else {
|
||||
return board.hasMember(userId);
|
||||
}
|
||||
},
|
||||
|
||||
fetch: ['boardId'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue