medbook:collaborations
An example of a Meteor method that uses this package
1Meteor.methods({ 2 removeSampleGroup: function (sampleGroupId) { 3 check(sampleGroupId, String); // can throw match error 4 5 var user = MedBook.findUser(Meteor.userId()); // can throw "user-not-found" 6 var sampleGroup = SampleGroups.findOne(sampleGroupId); 7 // can throw "permission-denied" if no access or invalid sampleGroup 8 user.ensureAccess(sampleGroup); 9 10 SampleGroups.remove(sampleGroupId); // we made it! 11 }, 12});
To bring up a modal to edit the collaborations of an object:
1MedBook.editCollaborations("SampleGroups", sampleGroupId);
To subscribe to a single object with collaboration security
1var sampleGroupId = SampleGroups.findOne(); 2 3Meteor.subscribe("/collaborations/singleObject", { 4 collectionString: "SampleGroups", 5 objectId: sampleGroupId, 6});