summaryrefslogtreecommitdiffstats
path: root/models/attachments.js
diff options
context:
space:
mode:
authorGhassen Rjab <rjab.ghassen@gmail.com>2017-07-30 04:27:38 +0100
committerGhassen Rjab <rjab.ghassen@gmail.com>2017-07-30 04:27:38 +0100
commitf521b7949a82a23697f441c523ce69a7591d735c (patch)
tree2941e709bcee4a0cc25907db3657870e8b6bc73b /models/attachments.js
parentf9f529e53f980d889df5bb1f818da55268284535 (diff)
downloadwekan-f521b7949a82a23697f441c523ce69a7591d735c.tar.gz
wekan-f521b7949a82a23697f441c523ce69a7591d735c.tar.bz2
wekan-f521b7949a82a23697f441c523ce69a7591d735c.zip
Fix files access bug
Diffstat (limited to 'models/attachments.js')
-rw-r--r--models/attachments.js18
1 files changed, 6 insertions, 12 deletions
diff --git a/models/attachments.js b/models/attachments.js
index d8398816..1c9878c7 100644
--- a/models/attachments.js
+++ b/models/attachments.js
@@ -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'],