diff mod_firewall/actions.lib.lua @ 2894:165d2877eeac

mod_firewall: Add experimental user-centric persistent marks behind a feature flag
author Kim Alvefur <zash@zash.se>
date Sat, 24 Feb 2018 21:40:56 +0100
parents 8fd37f0e108c
children b8f2e86df7ce
line wrap: on
line diff
--- a/mod_firewall/actions.lib.lua	Sat Feb 24 19:38:10 2018 +0100
+++ b/mod_firewall/actions.lib.lua	Sat Feb 24 21:40:56 2018 +0100
@@ -213,6 +213,14 @@
 	return [[session.firewall_marked_]]..idsafe(name)..[[ = nil;]]
 end
 
+function action_handlers.MARK_USER(name)
+	return [[if session.firewall_marks then session.firewall_marks.]]..idsafe(name)..[[ = current_timestamp; end]], { "timestamp" };
+end
+
+function action_handlers.UNMARK_USER(name)
+	return [[if session.firewall_marks then session.firewall_marks.]]..idsafe(name)..[[ = nil; end]], { "timestamp" };
+end
+
 function action_handlers.ADD_TO(spec)
 	local list_name, value = spec:match("(%S+) (.+)");
 	local meta_deps = {};