Software /
code /
prosody
Comparison
plugins/mod_authz_internal.lua @ 12733:2167e1639aab
mod_authz_internal: Allow specifying default role for public (remote) users
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 29 Sep 2022 12:46:02 +0100 |
parent | 12730:427dd01f0864 |
child | 12740:f58c6ae5edc1 |
comparison
equal
deleted
inserted
replaced
12732:f731eda8a873 | 12733:2167e1639aab |
---|---|
14 local is_component = hosts[host].type == "component"; | 14 local is_component = hosts[host].type == "component"; |
15 local host_user_role, server_user_role; | 15 local host_user_role, server_user_role; |
16 if is_component then | 16 if is_component then |
17 host_user_role = module:get_option_string("host_user_role", "prosody:user"); | 17 host_user_role = module:get_option_string("host_user_role", "prosody:user"); |
18 server_user_role = module:get_option_string("server_user_role"); | 18 server_user_role = module:get_option_string("server_user_role"); |
19 public_user_role = module:get_option_string("public_user_role"); | |
19 end | 20 end |
20 | 21 |
21 local role_store = module:open_store("account_roles"); | 22 local role_store = module:open_store("account_roles"); |
22 local role_map_store = module:open_store("account_roles", "map"); | 23 local role_map_store = module:open_store("account_roles", "map"); |
23 | 24 |
238 local user_host = jid_host(bare_jid); | 239 local user_host = jid_host(bare_jid); |
239 if host_user_role and user_host == host_suffix then | 240 if host_user_role and user_host == host_suffix then |
240 return role_registry[host_user_role]; | 241 return role_registry[host_user_role]; |
241 elseif server_user_role and hosts[user_host] then | 242 elseif server_user_role and hosts[user_host] then |
242 return role_registry[server_user_role]; | 243 return role_registry[server_user_role]; |
244 elseif public_user_role then | |
245 return role_registry[public_user_role]; | |
243 end | 246 end |
244 end | 247 end |
245 return nil; | 248 return nil; |
246 end | 249 end |
247 | 250 |