From aed412af10e6e1d5a76620a570d7ab04b24f4093 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sat, 27 Aug 2016 09:34:23 -0400 Subject: [PATCH] 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]