diff --git a/hourglass/server/main.js b/hourglass/server/main.js index 644dbae..9bdfbd2 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -214,6 +214,17 @@ 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]