aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_authz_config.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_authz_config.lua')
-rw-r--r--plugins/mod_authz_config.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/mod_authz_config.lua b/plugins/mod_authz_config.lua
new file mode 100644
index 00000000..41b8d9f0
--- /dev/null
+++ b/plugins/mod_authz_config.lua
@@ -0,0 +1,16 @@
+local normalize = require "util.jid".prep;
+local admin_jids = module:get_option_inherited_set("admins", {}) / normalize;
+local host = module.host;
+
+local admin_role = { ["prosody:admin"] = true };
+
+function get_user_roles(user)
+ return get_jid_roles(user.."@"..host);
+end
+
+function get_jid_roles(jid)
+ if admin_jids:contains(jid) then
+ return admin_role;
+ end
+ return nil;
+end