Mercurial > prosody-modules
comparison mod_invites_adhoc/mod_invites_adhoc.lua @ 5483:f9cecbd03e11
mod_invites_adhoc: Fall back to generic allow_user_invites for role-less users
Fixes #1752
Backport of Prosody rev dc0c20753d6c
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 18 May 2023 18:15:50 +0200 |
parents | fa99279f9d40 |
children | 825c6fb76c48 |
comparison
equal
deleted
inserted
replaced
5482:2f7fff6c8c73 | 5483:f9cecbd03e11 |
---|---|
55 local function may_invite_new_users(jid, context) | 55 local function may_invite_new_users(jid, context) |
56 if module.may then | 56 if module.may then |
57 return module:may(":invite-new-users", context); | 57 return module:may(":invite-new-users", context); |
58 elseif usermanager.get_roles then -- COMPAT w/0.12 | 58 elseif usermanager.get_roles then -- COMPAT w/0.12 |
59 local user_roles = usermanager.get_roles(jid, module.host); | 59 local user_roles = usermanager.get_roles(jid, module.host); |
60 if not user_roles then return; end | 60 if not user_roles then |
61 -- User has no roles we can check, just return default | |
62 return allow_user_invites; | |
63 end | |
64 | |
61 if user_roles["prosody:admin"] then | 65 if user_roles["prosody:admin"] then |
62 return true; | 66 return true; |
63 end | 67 end |
64 if allow_user_invite_roles then | 68 if allow_user_invite_roles then |
65 for allowed_role in allow_user_invite_roles do | 69 for allowed_role in allow_user_invite_roles do |