From aed412af10e6e1d5a76620a570d7ab04b24f4093 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sat, 27 Aug 2016 09:34:23 -0400 Subject: [PATCH 1/2] fix #58 with function getCode(classId) --- hourglass/server/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hourglass/server/main.js b/hourglass/server/main.js index b94db20..1a2c283 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -214,6 +214,15 @@ Meteor.methods({ throw "Unauthorized"; } }, + // For class admins to get code + 'getCode': function(classId) { + var foundclass = classes.find({_id: classId}); + if (foundclass && foundclass.admin == Meteor.userId()) { + return foundclass.code; + } else { + throw "Unauthorized"; + } + }, 'changeAdmin': function(input) { var found = Meteor.users.find({ _id: input[0] From af98278e647436c16c76f0df45885d85e7c5a781 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sat, 27 Aug 2016 09:47:59 -0400 Subject: [PATCH 2/2] use js filter on new server files --- hourglass/server/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hourglass/server/main.js b/hourglass/server/main.js index 1a2c283..47a5e01 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -216,7 +216,9 @@ Meteor.methods({ }, // For class admins to get code 'getCode': function(classId) { - var foundclass = classes.find({_id: classId}); + var foundclass = classes.find({ + _id: classId + }); if (foundclass && foundclass.admin == Meteor.userId()) { return foundclass.code; } else {