allowed only one chromebook to each user and began security framework

This commit is contained in:
Yaman 2014-12-30 11:35:40 -05:00
parent d11a34b27a
commit 8613010630
2 changed files with 15 additions and 4 deletions

View File

@ -6,6 +6,8 @@ var statusmap = {
Meteor.subscribe('chromebook');
//Meteor.subscribe('user');
Template.chromebook.helpers({
status_class: function() {
return statusmap[this.status];
@ -24,13 +26,17 @@ Template.chromebook.helpers({
Template.chromebook.events({
'click .available': function() {
if (Chromebooks.findOne({userid: Meteor.userId()}) === undefined) {
Chromebooks.update(this._id, {$set: {status: 1}});
Chromebooks.update(this._id, {$set: {last_checkout: new Date()}});
Chromebooks.update(this._id, {$set: {userid: Meteor.userId()}});
}
},
'click .checkedout': function() {
Chromebooks.update(this._id, {$set: {status: 0}});
Chromebooks.update(this._id, {$set: {last_checkout: null}});
Chromebooks.update(this._id, {$set: {userid: null}});
if (Meteor.userId() === this.userid) {
Chromebooks.update(this._id, {$set: {status: 0}});
Chromebooks.update(this._id, {$set: {last_checkout: null}});
Chromebooks.update(this._id, {$set: {userid: null}});
}
}
});

View File

@ -2,9 +2,14 @@ Meteor.publish('chromebook', function() {
return Chromebooks.find();
});
/*Meteor.publish('user', function() {
return Meteor.users.find({_id: this.userId},
{fields: {'_id': 1, 'profile.name': 1}});
});
*/
var adminusers = [
"ybq987@gmail.com",
// "ksjdragon@gmail.com",
// "mminer@bloomfield.org",
"qalieh.yaman90@bloomfield.org"
];