fix #58 with function getCode(classId)

This commit is contained in:
Yaman Qalieh 2016-08-27 09:34:23 -04:00
parent 96e413f005
commit aed412af10

View File

@ -214,6 +214,15 @@ Meteor.methods({
throw "Unauthorized"; 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) { 'changeAdmin': function(input) {
var found = Meteor.users.find({ var found = Meteor.users.find({
_id: input[0] _id: input[0]