Prevented moving dates for unauthorized users

This commit is contained in:
Kenneth Jao 2016-08-19 21:59:41 -04:00
parent 93bd64c4b4
commit 45576e7619

View File

@ -143,6 +143,13 @@ Template.main.helpers({
} }
}, },
calendarOptions() { calendarOptions() {
var inRole = false;
if(Meteor.userId() === Session.get("currentWork").creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
classes.findOne({_id: Session.get("currentWork")._id}).moderators.indexOf(Meteor.userId()) !== -1||
classes.findOne({_id: Session.get("currentWork")._id}).blockEdit.indexOf(Meteor.userId()) !== -1 ||
classes.findOne({_id: Session.get("currentWork")._id}).banned.indexOf(Meteor.userId()) !== -1
) var inRole = true;
return { return {
id: "fullcalendar", id: "fullcalendar",
height: window.innerHeight * 0.8, height: window.innerHeight * 0.8,
@ -165,7 +172,7 @@ Template.main.helpers({
title: title, title: title,
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
borderColor: "#444", borderColor: "#444",
startEditable: true, startEditable: inRole,
className: "workevent", className: "workevent",
}); });
}); });