update school directory
This commit is contained in:
parent
3bae4df7c0
commit
e2a38adee2
@ -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({
|
||||
|
||||
@ -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";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user