Changeset

11122:d60094d9b458

mod_auth_anonymous: Add config option to allow/disallow storage writes
author Matthew Wild <mwild1@gmail.com>
date Fri, 02 Oct 2020 16:44:30 +0100
parents 11121:2d38242a08dd
children 11125:5bcddab1659b
files plugins/mod_auth_anonymous.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_auth_anonymous.lua	Fri Oct 02 16:35:05 2020 +0200
+++ b/plugins/mod_auth_anonymous.lua	Fri Oct 02 16:44:30 2020 +0100
@@ -11,6 +11,8 @@
 local datamanager = require "util.datamanager";
 local hosts = prosody.hosts;
 
+local allow_storage = module:get_option_boolean("allow_anonymous_storage", false);
+
 -- define auth provider
 local provider = {};
 
@@ -62,10 +64,14 @@
 end
 
 function module.load()
-	datamanager.add_callback(dm_callback);
+	if not allow_storage then
+		datamanager.add_callback(dm_callback);
+	end
 end
 function module.unload()
-	datamanager.remove_callback(dm_callback);
+	if not allow_storage then
+		datamanager.remove_callback(dm_callback);
+	end
 end
 
 module:provides("auth", provider);