server issues, collection management, security issues

This commit is contained in:
yamanq 2016-02-07 01:46:01 -05:00
parent ce9f9da8b7
commit 942b1b1911
5 changed files with 63 additions and 24 deletions

View File

@ -22,3 +22,5 @@ rajit:bootstrap3-datepicker
twbs:bootstrap
accounts-google
accounts-ui
ongoworks:security
percolate:synced-cron

View File

@ -55,7 +55,9 @@ npm-mongo@1.4.39_1
oauth@1.1.6
oauth2@1.1.5
observe-sequence@1.0.7
ongoworks:security@1.3.0
ordered-dict@1.0.4
percolate:synced-cron@1.3.0
promise@0.5.1
rajit:bootstrap3-datepicker@1.5.0
random@1.0.5

View File

@ -11,12 +11,14 @@
<template name="client">
<input type="text" class="form-control" id="date">
{{#if allowed}}
<select id="post">
<option value="AC">AC</option>
<option value="Health">Health</option>
</select>
<select id="post">
<option value="AC">AC</option>
<option value="Health">Health</option>
</select>
<button>Submit</button>
<input type="text" class="form-control" id="date">
<button>Submit</button>
{{/if}}
</template>

View File

@ -1,30 +1,46 @@
var allowedu = {};
allowedu["ybq987@gmail.com"] = true;
allowedu["dweinger@bloomfield.org"] = true;
var done = false;
Meteor.subscribe('schedule');
Template.client.rendered=function() {
today = new Date()
$('#date').datepicker({
startDate: today.toLocaleDateString(),
orientation: "top auto",
daysOfWeekDisabled: "0,6",
autoclose: true,
todayHighlight: true
});
}
// schedule.find({}, {sort: {timestamp: 1}, limit: 2}).fetch()
Template.client.helpers({
status_class: function() {
return statusmap[this.status];
}
allowed: function() {
if (!(Meteor.user() === undefined) && Meteor.user().services.google.email in allowedu) {
return true
} else {
return false;
}
}
})
Template.client.events({
"focus input": function() {
if (!done) {
today = new Date()
$('#date').datepicker({
startDate: today.toLocaleDateString(),
orientation: "top auto",
daysOfWeekDisabled: "0,6",
autoclose: true,
todayHighlight: true
});
done = true;
}
},
"click button": function() {
pre = document.getElementById("date").value;
document.getElementById("date").value = "";

View File

@ -1,15 +1,31 @@
var currentpass = "test";
var allowed = {};
allowed["ybq987@gmail.com"] = true;
allowed["dweinger@bloomfield.org"] = true;
// schedule.permit(['insert', 'update', 'remove']).never().apply();
schedule.remove({})
schedule.permit(['insert', 'update', 'remove']).never().apply();
SyncedCron.add({
name: 'Remove Entries past today',
schedule: function(parser) {
return parser.recur().on('00:00:00').time();
},
job: function() {
var today = new Date();
// Remove matchng Documents
schedule.remove({timestamp: {$lt: today}});
}
});
SyncedCron.start();
Meteor.methods({
add_button: function(chrome, pre, post) {
if (Meteor.user().services.google.email in allowed) {
if (Meteor.user() != undefined && Meteor.user().services.google.email in allowed) {
madate = pre.split("/");
date = new Date();
@ -19,7 +35,8 @@ Meteor.methods({
schedule.insert({
"pretext": date.toDateString().slice(0,date.length),
"aftertext": post
"aftertext": post,
"timestamp": date
});
}
}