update school directory

This commit is contained in:
yamanq 2016-08-25 21:57:22 -04:00
parent 3bae4df7c0
commit e2a38adee2
2 changed files with 2 additions and 19 deletions

View File

@ -5,8 +5,6 @@ requests = new Mongo.Collection("Requests");
schools.schema = new SimpleSchema({
name: {type: String},
status: {type: Boolean},
creator: {type: String},
});
classes.schema = new SimpleSchema({

View File

@ -132,24 +132,9 @@ Meteor.methods({
// School Functions
'createSchool': function(schoolname) {
if (Meteor.user() !== null &&
schools.findOne({
name: schoolname
}) !== null &&
schools.findOne({
status: false,
creator: Meteor.userId()
}) !== null) {
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
var stat = true;
} else {
var stat = false;
}
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
schools.insert({
name: schoolname,
status: stat,
creator: Meteor.userId()
name: schoolname
});
} else {
throw "Unauthorized";