comparison mod_audit/mod_audit.lua @ 5115:4a5837591380

mod_audit: remove event hook Let's keep it simple for now---also we expose the audit functionality on the moduleapi level anyway.
author Jonas Schäfer <jonas@wielicki.name>
date Thu, 28 Apr 2022 20:22:03 +0200
parents ae83200fb55f
children d9577083c5f5
comparison
equal deleted inserted replaced
5078:36d3f11724c8 5115:4a5837591380
1 module:set_global(); 1 module:set_global();
2
3 local audit_log_limit = module:get_option_number("audit_log_limit", 10000);
4 local cleanup_after = module:get_option_string("audit_log_expires_after", "2w");
2 5
3 local time_now = os.time; 6 local time_now = os.time;
4 local st = require "util.stanza"; 7 local st = require "util.stanza";
5 local moduleapi = require "core.moduleapi"; 8 local moduleapi = require "core.moduleapi";
6 9
79 end 82 end
80 83
81 function moduleapi.audit(module, user, event_type, extra) 84 function moduleapi.audit(module, user, event_type, extra)
82 audit(module.host, user, "mod_" .. module:get_name(), event_type, extra); 85 audit(module.host, user, "mod_" .. module:get_name(), event_type, extra);
83 end 86 end
84
85 module:hook("audit", audit, 0);