diff --git a/hourglass/collections/main.js b/hourglass/collections/main.js index 97f810f..5607f1a 100644 --- a/hourglass/collections/main.js +++ b/hourglass/collections/main.js @@ -4,6 +4,7 @@ work = new Mongo.Collection("Work"); schools.schema = new SimpleSchema({ name: {type: String}, + status: {type: Boolean}, aliases: {type: [String]} }); diff --git a/hourglass/server/main.js b/hourglass/server/main.js index 243df1d..698e472 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -8,9 +8,13 @@ _uuid4 = function(cc) { Meteor.methods({ 'genCode': function() { - return 'xxxxxx'.replace(/[x]/g, _uuid4); + return 'xxxxxx'.replace(/[x]/g, _uuid4); }, - //No Security + 'createSchool': function(schoolname) { + if (Meteor.user() != null && schools.find({name:input.school}).fetch().length === 0) { + schools.insert({name: schoolname, status: false}); + } + }, 'createClass': function(input) { classes.schema.validate(input); if(Meteor.user() != null && classes.find({status:false, admin:Meteor.userId()}).fetch().length < 5 &&