Comparison

plugins/mod_invites_adhoc.lua @ 12491:dc0c20753d6c 0.12

mod_invites_adhoc: Fall back to generic allow_user_invites for role-less users Fixes #1752
author Matthew Wild <mwild1@gmail.com>
date Fri, 06 May 2022 17:08:49 +0100
parent 12145:212bac94aedd
child 12642:9061f9621330
comparison
equal deleted inserted replaced
12489:8b42575738f0 12491:dc0c20753d6c
43 -- This is for checking if the specified JID may create invites 43 -- This is for checking if the specified JID may create invites
44 -- that allow people to register accounts on this host. 44 -- that allow people to register accounts on this host.
45 local function may_invite_new_users(jid) 45 local function may_invite_new_users(jid)
46 if usermanager.get_roles then 46 if usermanager.get_roles then
47 local user_roles = usermanager.get_roles(jid, module.host); 47 local user_roles = usermanager.get_roles(jid, module.host);
48 if not user_roles then return; end 48 if not user_roles then
49 -- User has no roles we can check, just return default
50 return allow_user_invites;
51 end
52
49 if user_roles["prosody:admin"] then 53 if user_roles["prosody:admin"] then
50 return true; 54 return true;
51 end 55 end
52 if allow_user_invite_roles then 56 if allow_user_invite_roles then
53 for allowed_role in allow_user_invite_roles do 57 for allowed_role in allow_user_invite_roles do