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({
|
schools.schema = new SimpleSchema({
|
||||||
name: {type: String},
|
name: {type: String},
|
||||||
status: {type: Boolean},
|
|
||||||
creator: {type: String},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
classes.schema = new SimpleSchema({
|
classes.schema = new SimpleSchema({
|
||||||
|
|||||||
@ -132,24 +132,9 @@ Meteor.methods({
|
|||||||
|
|
||||||
// School Functions
|
// School Functions
|
||||||
'createSchool': function(schoolname) {
|
'createSchool': function(schoolname) {
|
||||||
if (Meteor.user() !== null &&
|
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
|
||||||
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;
|
|
||||||
}
|
|
||||||
schools.insert({
|
schools.insert({
|
||||||
name: schoolname,
|
name: schoolname
|
||||||
status: stat,
|
|
||||||
creator: Meteor.userId()
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw "Unauthorized";
|
throw "Unauthorized";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user