Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 13308:d539cb48c6e9
mod_muc: Switch to module:could() for some implicit access control checks
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 07 Nov 2023 11:50:59 +0000 |
parent | 13307:8fb8a253f0a1 |
child | 13495:47e1df2d0a37 |
comparison
equal
deleted
inserted
replaced
13307:8fb8a253f0a1 | 13308:d539cb48c6e9 |
---|---|
121 | 121 |
122 if module:get_option_boolean("component_admins_as_room_owners", true) then | 122 if module:get_option_boolean("component_admins_as_room_owners", true) then |
123 -- Monkey patch to make server admins room owners | 123 -- Monkey patch to make server admins room owners |
124 local _get_affiliation = room_mt.get_affiliation; | 124 local _get_affiliation = room_mt.get_affiliation; |
125 function room_mt:get_affiliation(jid) | 125 function room_mt:get_affiliation(jid) |
126 if module:may(":automatic-ownership", jid) then return "owner"; end | 126 if module:could(":automatic-ownership", jid) then return "owner"; end |
127 return _get_affiliation(self, jid); | 127 return _get_affiliation(self, jid); |
128 end | 128 end |
129 | 129 |
130 local _set_affiliation = room_mt.set_affiliation; | 130 local _set_affiliation = room_mt.set_affiliation; |
131 function room_mt:set_affiliation(actor, jid, affiliation, reason, data) | 131 function room_mt:set_affiliation(actor, jid, affiliation, reason, data) |
132 if affiliation ~= "owner" and module:may(":automatic-ownership", jid) then return nil, "modify", "not-acceptable"; end | 132 if affiliation ~= "owner" and module:could(":automatic-ownership", jid) then return nil, "modify", "not-acceptable"; end |
133 return _set_affiliation(self, actor, jid, affiliation, reason, data); | 133 return _set_affiliation(self, actor, jid, affiliation, reason, data); |
134 end | 134 end |
135 end | 135 end |
136 | 136 |
137 local persistent_rooms_storage = module:open_store("persistent"); | 137 local persistent_rooms_storage = module:open_store("persistent"); |