MUC: Allow moderators which are not owners to change roles.

Wed, 14 Apr 2010 17:54:33 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Wed, 14 Apr 2010 17:54:33 +0500
changeset 2979
b1726c2a2afc
parent 2967
c39ad633b26d
child 2980
9f593650b3ce

MUC: Allow moderators which are not owners to change roles.

plugins/muc/muc.lib.lua file | annotate | diff | comparison | revisions
--- a/plugins/muc/muc.lib.lua	Fri Apr 09 12:25:54 2010 +0100
+++ b/plugins/muc/muc.lib.lua	Wed Apr 14 17:54:33 2010 +0500
@@ -673,7 +673,7 @@
 function room_mt:set_role(actor, occupant_jid, role, callback, reason)
 	if role == "none" then role = nil; end
 	if role and role ~= "moderator" and role ~= "participant" and role ~= "visitor" then return nil, "modify", "not-acceptable"; end
-	if self:get_affiliation(actor) ~= "owner" then return nil, "cancel", "not-allowed"; end
+	if self:get_role(self._jid_nick[actor]) ~= "moderator" then return nil, "cancel", "not-allowed"; end
 	local occupant = self._occupants[occupant_jid];
 	if not occupant then return nil, "modify", "not-acceptable"; end
 	if occupant.affiliation == "owner" or occupant.affiliation == "admin" then return nil, "cancel", "not-allowed"; end

mercurial