diff mod_audit/mod_audit.lua @ 4934:08dea42a302a

mod_audit*: fix luacheck warnings
author Jonas Schäfer <jonas@wielicki.name>
date Tue, 26 Apr 2022 22:37:13 +0200
parents 530d116b7f68
children ae83200fb55f
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