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]