-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrac.js
60 lines (56 loc) · 1.85 KB
/
trac.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
classes = new Meteor.Collection("Classes");
students = new Meteor.Collection("Students");
events = new Meteor.Collection("Events");
classes.allow({
insert: function(userId, docs) {
return Roles.userIsInRole(userId, "super-admin") || Roles.userIsInRole(userId, "class-admin");
},
update: function(userId, docs, fields, modifier) {
return Roles.userIsInRole(userId, "super-admin") || Roles.userIsInRole(userId, "class-admin");
},
remove: function(userId, docs) {
return Roles.userIsInRole(userId, "super-admin") || Roles.userIsInRole(userId, "class-admin");
}
});
students.allow({
insert: function(userId, docs) {
return Roles.userIsInRole(userId, "super-admin") || Roles.userIsInRole(userId, "student-admin");
},
update: function(userId, docs, fields, modifier) {
return Roles.userIsInRole(userId, "super-admin") || Roles.userIsInRole(userId, "student-admin");
},
remove: function(userId, docs) {
return Roles.userIsInRole(userId, "super-admin") || Roles.userIsInRole(userId, "student-admin");
}
});
events.allow({
insert: function(userId, docs) {
return Roles.userIsInRole(userId, "super-admin") || Roles.userIsInRole(userId, "event-admin");
},
update: function(userId, docs, fields, modifier) {
return Roles.userIsInRole(userId, "super-admin") || Roles.userIsInRole(userId, "event-admin");
},
remove: function(userId, docs) {
return Roles.userIsInRole(userId, "super-admin") || Roles.userIsInRole(userId, "event-admin");
}
});
Router.map(function () {
this.route('navbar', {
path: '/'
});
this.route('classes', {
path: '/classes'
});
this.route('students', {
path: '/students',
data: function() {
return {
classId:this.params.classId,
students:students.find({classId: this.params.classId})
}
}
});
this.route('events', {
path: '/events'
});
});