Software /
code /
prosody
Comparison
util/pubsub.lua @ 4367:98b258b7d5dc
util.pubsub: Remove access checking from remove_all_subscriptions (temporarily?)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 30 Aug 2011 17:51:36 -0400 |
parent | 4366:b6c18cadd3ec |
child | 5181:1e9508ae44cc |
comparison
equal
deleted
inserted
replaced
4366:b6c18cadd3ec | 4367:98b258b7d5dc |
---|---|
170 self.events.fire_event("subscription-removed", { node = node, jid = jid, normalized_jid = normal_jid }); | 170 self.events.fire_event("subscription-removed", { node = node, jid = jid, normalized_jid = normal_jid }); |
171 return true; | 171 return true; |
172 end | 172 end |
173 | 173 |
174 function service:remove_all_subscriptions(actor, jid) | 174 function service:remove_all_subscriptions(actor, jid) |
175 -- Access checking | |
176 local cap; | |
177 if actor == true or jid == actor or self:jids_equal(actor, jid) then | |
178 cap = "unsubscribe"; | |
179 else | |
180 cap = "unsubscribe_other"; | |
181 end | |
182 if not self:may(node, actor, cap) then | |
183 return false, "forbidden"; | |
184 end | |
185 if not self:may(node, jid, "be_unsubscribed") then | |
186 return false, "forbidden"; | |
187 end | |
188 -- | |
189 local normal_jid = self.config.normalize_jid(jid); | 175 local normal_jid = self.config.normalize_jid(jid); |
190 local subs = self.subscriptions[normal_jid] | 176 local subs = self.subscriptions[normal_jid] |
191 subs = subs and subs[jid]; | 177 subs = subs and subs[jid]; |
192 if subs then | 178 if subs then |
193 for node in pairs(subs) do | 179 for node in pairs(subs) do |