aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-03-24 22:30:14 +0000
committerMatthew Wild <mwild1@gmail.com>2022-03-24 22:30:14 +0000
commitd7943336f2fc8ab7503566cd1f2e5b5fea0fa7ab (patch)
tree2843b82fc1cd8eb69258f86b62f1fecd1f59885d /plugins
parent5311134111f3c9a65ac12ffe5e06e3edf690cb47 (diff)
parentcbcb57fa24650c6ac001c4c1c9ab39a61b6266eb (diff)
downloadprosody-d7943336f2fc8ab7503566cd1f2e5b5fea0fa7ab.tar.gz
prosody-d7943336f2fc8ab7503566cd1f2e5b5fea0fa7ab.zip
Merge 0.12->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/muc.lib.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 9124a70f..01427dbe 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -1583,15 +1583,16 @@ function room_mt:may_set_role(actor, occupant, role)
return event.allowed, event.error, event.condition;
end
- -- Can't do anything to other owners or admins
- local occupant_affiliation = self:get_affiliation(occupant.bare_jid);
- if occupant_affiliation == "owner" or occupant_affiliation == "admin" then
+ local actor_affiliation = self:get_affiliation(actor) or "none";
+ local occupant_affiliation = self:get_affiliation(occupant.bare_jid) or "none";
+
+ -- Can't do anything to someone with higher affiliation
+ if valid_affiliations[actor_affiliation] < valid_affiliations[occupant_affiliation] then
return nil, "cancel", "not-allowed";
end
-- If you are trying to give or take moderator role you need to be an owner or admin
if occupant.role == "moderator" or role == "moderator" then
- local actor_affiliation = self:get_affiliation(actor);
if actor_affiliation ~= "owner" and actor_affiliation ~= "admin" then
return nil, "cancel", "not-allowed";
end