add publish to server
This commit is contained in:
parent
3f984fca63
commit
2c4b480e9d
@ -17,12 +17,64 @@ superadmins = [
|
||||
|
||||
for (var i = 0; i < superadmins.length; i++) {
|
||||
var superadmin = superadmins[i];
|
||||
if (Meteor.users.findOne({"services.google.email": superadmin})) {
|
||||
var userId = Meteor.users.findOne({"services.google.email": superadmin})._id;
|
||||
if (Meteor.users.findOne({
|
||||
"services.google.email": superadmin
|
||||
})) {
|
||||
var userId = Meteor.users.findOne({
|
||||
"services.google.email": superadmin
|
||||
})._id;
|
||||
Roles.addUsersToRoles(userId, ['superadmin']);
|
||||
}
|
||||
}
|
||||
|
||||
Meteor.publish('schools', function() {
|
||||
return schools.find();
|
||||
});
|
||||
|
||||
Meteor.publish('classes', function() {
|
||||
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
|
||||
return classes.find();
|
||||
} else {
|
||||
return classes.find({
|
||||
$or: [{
|
||||
privacy: false
|
||||
}, {
|
||||
_id: {
|
||||
$in: Meteor.user().profile.classes
|
||||
}
|
||||
}]
|
||||
}, {
|
||||
fields: {
|
||||
school: 1,
|
||||
name: 1,
|
||||
hour: 1,
|
||||
teacher: 1,
|
||||
admin: 1,
|
||||
status: 1,
|
||||
privacy: 1,
|
||||
category: 1,
|
||||
moderators: 1,
|
||||
banned: 1,
|
||||
blockEdit: 1,
|
||||
subscribers: 1
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Meteor.publish('work', function() {
|
||||
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
|
||||
return work.find();
|
||||
} else {
|
||||
return work.find({
|
||||
class: {
|
||||
$in: Meteor.user().profile.classes
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
worktype = ["test", "quiz", "project", "normal"];
|
||||
Meteor.methods({
|
||||
'genCode': function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user