Created
December 14, 2021 20:07
-
-
Save shawnchin/39c6f171bafc6150591fb11bbcddfa67 to your computer and use it in GitHub Desktop.
muc_owner_allow_kick.patch for prosody 0.11.10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- muc.lib.lua 2021-12-14 19:48:43.195680418 +0000 | |
+++ muc.lib.lua 2021-12-14 20:01:22.865824156 +0000 | |
@@ -1390,15 +1390,16 @@ | |
if actor == true then | |
actor = nil -- So we can pass it safely to 'publicise_occupant_status' below | |
else | |
+ local actor_affiliation = self:get_affiliation(actor); | |
+ | |
-- 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 | |
+ if (occupant_affiliation == "owner" and actor_affiliation ~= "owner") or (occupant_affiliation == "admin" and actor_affiliation ~= "admin" and actor_affiliation ~= "owner") 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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment