Comparison

plugins/mod_authz_internal.lua @ 10659:8f95308c3c45

usermanager, mod_authz_*: Merge mod_authz_config and mod_authz_internal into the latter
author Matthew Wild <mwild1@gmail.com>
date Sun, 23 Feb 2020 12:38:43 +0000
child 11472:c32753ceb0f0
comparison
equal deleted inserted replaced
10658:52c6dfa04dba 10659:8f95308c3c45
1 local normalize = require "util.jid".prep;
2 local admin_jids = module:get_option_inherited_set("admins", {}) / normalize;
3 local host = module.host;
4 local role_store = module:open_store("roles");
5
6 local admin_role = { ["prosody:admin"] = true };
7
8 function get_user_roles(user)
9 if admin_jids:contains(user.."@"..host) then
10 return admin_role;
11 end
12 return role_store:get(user);
13 end
14
15 function get_jid_roles(jid)
16 if admin_jids:contains(jid) then
17 return admin_role;
18 end
19 return nil;
20 end
21
22