-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix signin bug, collaboration security
- Loading branch information
Robert Baertsch
committed
Jul 7, 2016
1 parent
22ba6a1
commit e3e22ee
Showing
6 changed files
with
28 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
Meteor.publish("singleCase", function(cid) { | ||
var c = Cases.find({_id:cid}); | ||
var p = Posts.find({caseId:cid}); | ||
//user.ensureAccess(c); // throws "permission-denied" if no access | ||
return [ c, p ]; | ||
let user = MedBook.ensureUser(this.userId); | ||
|
||
// throws "permission-denied" if no access | ||
user.ensureAccess(Cases.findOne(cid)); | ||
|
||
return [ | ||
Cases.find(cid), | ||
Posts.find({caseId:cid}) | ||
]; | ||
}); | ||
|
||
Meteor.publish("searchCase", function(query) { | ||
let user = MedBook.ensureUser(this.userId); | ||
console.log('user',user); | ||
|
||
// default to search all | ||
if (!query) query = {}; | ||
|
||
query.collaborations = { $in: user.getCollaborations() }; | ||
|
||
console.log("query:", query); | ||
var cases = Cases.find(query, { limit: 20 }); | ||
//user.ensureAccess(cases); // throws "permission-denied" if no access | ||
return cases; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters