Comparison

plugins/mod_authz_internal.lua @ 10633:d1cc6af0fb97

usermanager, mod_authz_internal: Move admin-checking functionality into a module. Fixes #517 (ish). Note: Removes the ability for mod_auth_* providers to determine user admin status. Such modules will need to have their is_admin methods ported to be a mod_authz_* provider.
author Matthew Wild <mwild1@gmail.com>
date Mon, 27 Jan 2020 21:54:59 +0000
comparison
equal deleted inserted replaced
10632:c9de8275aaf2 10633:d1cc6af0fb97
1 local normalize = require "util.jid".prep;
2 local admin_jids = module:get_option_inherited_set("admins", {}) / normalize;
3 local host = module.host;
4
5 local admin_role = { ["prosody:admin"] = true };
6
7 function get_user_roles(user)
8 return get_jid_roles(user.."@"..host);
9 end
10
11 function get_jid_roles(jid)
12 if admin_jids:contains(jid) then
13 return admin_role;
14 end
15 return nil;
16 end