Merge branch 'master' of https://github.com/ksjdragon/hourglass
This commit is contained in:
commit
f1d7e180f0
@ -29,3 +29,4 @@ iron:router
|
||||
ongoworks:security
|
||||
mizzao:autocomplete
|
||||
alanning:roles
|
||||
rzymek:fullcalendar
|
||||
|
||||
@ -68,6 +68,7 @@ mobile-experience@1.0.4
|
||||
mobile-status-bar@1.0.12
|
||||
modules@0.7.5
|
||||
modules-runtime@0.7.5
|
||||
momentjs:moment@2.8.4
|
||||
mongo@1.1.10
|
||||
mongo-id@1.0.5
|
||||
npm-mongo@1.5.45
|
||||
@ -85,6 +86,7 @@ reactive-var@1.0.10
|
||||
reload@1.1.10
|
||||
retry@1.0.8
|
||||
routepolicy@1.0.11
|
||||
rzymek:fullcalendar@2.7.2
|
||||
service-configuration@1.0.10
|
||||
session@1.1.6
|
||||
spacebars@1.0.12
|
||||
|
||||
@ -11,17 +11,23 @@ Meteor.methods({
|
||||
return 'xxxxxx'.replace(/[x]/g, _uuid4);
|
||||
},
|
||||
'createSchool': function(schoolname) {
|
||||
// if superadmin, no need for approval
|
||||
if (Meteor.user() != null && schools.findOne({name:input.school}) != null &&
|
||||
schools.findOne({status: false, creator: Meteor.userId()}) != null) {
|
||||
|
||||
schools.insert({name: schoolname, status: false, creator: Meteor.userId()});
|
||||
}
|
||||
},
|
||||
'deleteSchool': function(schoolid) {
|
||||
// alanning:roles implementation here
|
||||
schools.remove({_id: schoolid})
|
||||
},
|
||||
'createClass': function(input) {
|
||||
// if superadmin, no need for approval
|
||||
classes.schema.validate(input);
|
||||
if(Meteor.user() != null && classes.find({status:false, admin:Meteor.userId()}).fetch().length < 5 &&
|
||||
schools.findOne({name:input.school}) != null && input.status === false) {
|
||||
|
||||
schools.findOne({name:input.school}) != null) {
|
||||
input.status = false;
|
||||
input.subscribers = 0;
|
||||
input.admin = Meteor.userId()
|
||||
if (input.privacy) {
|
||||
@ -44,6 +50,13 @@ Meteor.methods({
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
'deleteClass': function(classid) {
|
||||
found = classes.findOne({_id: classid});
|
||||
// Add roles
|
||||
if (Meteor.user() != null && found != null && found.admin === Meteor.user()._id) {
|
||||
classes.remove({_id: classid})
|
||||
}
|
||||
},
|
||||
'editProfile': function(change) {
|
||||
current = Meteor.user().profile;
|
||||
current.school = change[0];
|
||||
@ -61,7 +74,7 @@ Meteor.methods({
|
||||
},
|
||||
'joinClass': function(change, pass) {
|
||||
found = classes.findOne({_id: change, status: true});
|
||||
if (Meteor.user() != null && found.length > 0 && pass === found[0].code && Meteor.user().profile.classes.indexOf(change) === -1) {
|
||||
if (Meteor.user() != null && found != null && pass === found.code && Meteor.user().profile.classes.indexOf(change) === -1) {
|
||||
current = Meteor.user().profile;
|
||||
current.classes.append(change);
|
||||
Meteor.users.update({_id: Meteor.userId()}, {$set: {profile: current}});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user