Mercurial > prosody-modules
comparison mod_vcard_muc/mod_vcard_muc.lua @ 5290:dddac5a3f447
mod_vcard_muc: take roles into account for access check
This allows admins on the MUC component to force-set avatars, even
if they are not owners in a particular MUC, similar to how they
are granted auto-ownership in other contexts.
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Wed, 29 Mar 2023 17:52:21 +0200 |
parents | 3f3b672b7616 |
children |
comparison
equal
deleted
inserted
replaced
5289:308024be6d6f | 5290:dddac5a3f447 |
---|---|
74 session.send(st.reply(stanza):add_child(vCard)); -- send vCard! | 74 session.send(st.reply(stanza):add_child(vCard)); -- send vCard! |
75 else | 75 else |
76 session.send(st.error_reply(stanza, "cancel", "item-not-found")); | 76 session.send(st.error_reply(stanza, "cancel", "item-not-found")); |
77 end | 77 end |
78 else | 78 else |
79 if from_affiliation == "owner" then | 79 if from_affiliation == "owner" or (module.may and module:may("muc:automatic-ownership", from)) then |
80 if vcards:set(room_node, st.preserialize(stanza.tags[1])) then | 80 if vcards:set(room_node, st.preserialize(stanza.tags[1])) then |
81 session.send(st.reply(stanza):tag("vCard", { xmlns = "vcard-temp" })); | 81 session.send(st.reply(stanza):tag("vCard", { xmlns = "vcard-temp" })); |
82 broadcast_presence(room, nil) | 82 broadcast_presence(room, nil) |
83 | 83 |
84 room:broadcast_message(st.message({ from = room.jid, type = "groupchat" }) | 84 room:broadcast_message(st.message({ from = room.jid, type = "groupchat" }) |