Changeset

4933:08dea42a302a

mod_audit*: fix luacheck warnings
author Jonas Schäfer <jonas@wielicki.name>
date Tue, 26 Apr 2022 22:37:13 +0200
parents 4932:530d116b7f68
children 4934:ae83200fb55f
files mod_audit/mod_audit.lua mod_audit_auth/mod_audit_auth.lua mod_audit_register/mod_audit_register.lua
diffstat 3 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_audit/mod_audit.lua	Tue Apr 26 22:32:44 2022 +0200
+++ b/mod_audit/mod_audit.lua	Tue Apr 26 22:37:13 2022 +0200
@@ -12,7 +12,7 @@
 	if store then
 		return store
 	end
-	local store = module:context(host):open_store("audit", "archive");
+	store = module:context(host):open_store("audit", "archive");
 	rawset(self, host, store);
 	return store;
 end
@@ -41,14 +41,14 @@
 	if not host or host == "*" then
 		error("cannot log audit events for global");
 	end
-	local user = user or host_wide_user;
+	local user_key = user or host_wide_user;
 
 	local attr = {
 		["source"] = source,
 		["type"] = event_type,
 	};
-	if user ~= host_wide_user then
-		attr.user = user;
+	if user_key ~= host_wide_user then
+		attr.user = user_key;
 	end
 	local stanza = st.stanza("audit-event", attr);
 	if extra ~= nil then
@@ -68,7 +68,7 @@
 		end
 	end
 
-	local id, err = stores[host]:append(nil, nil, stanza, time_now(), user);
+	local id, err = stores[host]:append(nil, nil, stanza, time_now(), user_key);
 	if err then
 		module:log("error", "failed to persist audit event: %s", err);
 		return
--- a/mod_audit_auth/mod_audit_auth.lua	Tue Apr 26 22:32:44 2022 +0200
+++ b/mod_audit_auth/mod_audit_auth.lua	Tue Apr 26 22:37:13 2022 +0200
@@ -1,4 +1,5 @@
 module:depends("audit");
+-- luacheck: read globals module.audit
 
 module:hook("authentication-failure", function(event)
 	local session = event.session;
--- a/mod_audit_register/mod_audit_register.lua	Tue Apr 26 22:32:44 2022 +0200
+++ b/mod_audit_register/mod_audit_register.lua	Tue Apr 26 22:37:13 2022 +0200
@@ -1,4 +1,5 @@
 module:depends("audit");
+-- luacheck: read globals module.audit
 
 local st = require "util.stanza";