publish and subscribe

This commit is contained in:
Yaman Qalieh 2016-08-12 20:42:29 -04:00
parent 2c4b480e9d
commit cdd2cd99ab
6 changed files with 13 additions and 10 deletions

View File

@ -17,7 +17,6 @@ standard-minifier-js@1.1.8 # JS minifier run for production mode
es5-shim@4.6.13 # ECMAScript 5 compatibility for older browsers.
ecmascript@0.5.7 # Enable ECMAScript2015+ syntax in app code
autopublish@1.0.7 # Publish all data to the clients (for prototyping)
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)
fortawesome:fontawesome
session

View File

@ -6,7 +6,6 @@ accounts-ui-unstyled@1.1.12
alanning:roles@1.2.15
aldeed:simple-schema@1.5.3
allow-deny@1.0.5
autopublish@1.0.7
autoupdate@1.2.11
babel-compiler@6.9.0
babel-runtime@0.1.10

View File

@ -4,7 +4,9 @@ import {
import './main.html';
Meteor.subscribe('schools');
Meteor.subscribe('classes');
Meteor.subscribe('work');
var openValues = {
"menu": "-25%",
"options": "-20%"

View File

@ -2,6 +2,11 @@ import {
Template
} from 'meteor/templating';
Meteor.subscribe('schools');
Meteor.subscribe('classes');
Meteor.subscribe('work');
Session.set("profInputOpen", null);
Session.set("profClassTab", "manClass");
Session.set("modifying", null);

View File

@ -6,7 +6,6 @@ schools.schema = new SimpleSchema({
name: {type: String},
status: {type: Boolean},
creator: {type: String},
aliases: {type: [String]}
});
classes.schema = new SimpleSchema({
@ -30,7 +29,6 @@ work.schema = new SimpleSchema({
name: {type: String},
class: {type: String},
dueDate: {type: Date},
aliases: {type: [String], optional: true},
submittor: {type: String, optional: true},
confirmations: {type: [String], optional: true},
reports: {type: [String], optional: true},

View File

@ -32,7 +32,7 @@ Meteor.publish('schools', function() {
});
Meteor.publish('classes', function() {
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) {
return classes.find();
} else {
return classes.find({
@ -40,7 +40,7 @@ Meteor.publish('classes', function() {
privacy: false
}, {
_id: {
$in: Meteor.user().profile.classes
$in: this.user().profile.classes
}
}]
}, {
@ -63,12 +63,12 @@ Meteor.publish('classes', function() {
});
Meteor.publish('work', function() {
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) {
return work.find();
} else {
return work.find({
class: {
$in: Meteor.user().profile.classes
$in: this.user().profile.classes
}
});
}