-
Notifications
You must be signed in to change notification settings - Fork 3
/
hipaa.audit.js
52 lines (41 loc) · 1.2 KB
/
hipaa.audit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Hipaa = new Meteor.Collection("hipaa");
Hipaa.allow({
insert: function(){
return true;
},
// once written, people should be able to change the audit log
update: function () {
return false;
},
// once written, people should be able to change the audit log
remove: function(){
return false;
}
});
if (Meteor.isClient) {
Meteor.subscribe('hipaa');
Template.hipaaLog.hipaaAudit = function () {
return Hipaa.find();
}
Template.hipaaEntry.entry_timestamp = function(){
return new Date(this.timestamp).format("yyyy, mmm d, ddd, HH:MM Z");
}
}
if(Meteor.isServer) {
Meteor.startup(function () {
console.log('Meteor.startup...');
if (Hipaa.find().count() == 0) {
console.log('No events in hipaa audit log! Initializing audit log...');
var eventId = Hipaa.insert({
owner: 'System',
loglevel: LogLevel.Hipaa,
text: "Initializing audit log.",
timestamp: new Date().getTime()
});
console.log(eventId);
}
});
Meteor.publish('hipaa', function () {
return Hipaa.find();
});
}