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({ schools.schema = new SimpleSchema({
name: {type: String}, name: {type: String},
status: {type: Boolean},
creator: {type: String},
}); });
classes.schema = new SimpleSchema({ classes.schema = new SimpleSchema({

View File

@ -132,24 +132,9 @@ Meteor.methods({
// School Functions // School Functions
'createSchool': function(schoolname) { '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'])) { if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
var stat = true;
} else {
var stat = false;
}
schools.insert({ schools.insert({
name: schoolname, name: schoolname
status: stat,
creator: Meteor.userId()
}); });
} else { } else {
throw "Unauthorized"; throw "Unauthorized";