changeAdmin fixes

This commit is contained in:
Yaman Qalieh 2016-08-17 19:18:02 -04:00
parent 6231a743ea
commit b460a2fec4

View File

@ -162,7 +162,8 @@ Meteor.methods({
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
classes.update({_id: input[1]}, {$set: {admin: input[0]}});
} else if (found && foundclass && foundclass.admin == Meteor.userId() &&
foundclass.banned.indexOf(input[0]) != -1) {
foundclass.banned.indexOf(input[0]) === -1 &&
foundclass.subscribers.indexOf(input[0]) !== -1) {
classes.update({_id: input[1]}, {$set: {admin: input[0]}});
} else {
throw "Unauthorized";