Software /
code /
prosody
Comparison
util/pubsub.lua @ 5776:bd0ff8ae98a8
Remove all trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Fri, 09 Aug 2013 17:48:21 +0200 |
parent | 5675:e29ece65e3b0 |
child | 5851:cdcfd93e2f43 |
child | 5971:637731f0b9a3 |
comparison
equal
deleted
inserted
replaced
5775:a6c2b8933507 | 5776:bd0ff8ae98a8 |
---|---|
27 return normalize(jid1) == normalize(jid2); | 27 return normalize(jid1) == normalize(jid2); |
28 end | 28 end |
29 | 29 |
30 function service:may(node, actor, action) | 30 function service:may(node, actor, action) |
31 if actor == true then return true; end | 31 if actor == true then return true; end |
32 | 32 |
33 local node_obj = self.nodes[node]; | 33 local node_obj = self.nodes[node]; |
34 local node_aff = node_obj and node_obj.affiliations[actor]; | 34 local node_aff = node_obj and node_obj.affiliations[actor]; |
35 local service_aff = self.affiliations[actor] | 35 local service_aff = self.affiliations[actor] |
36 or self.config.get_affiliation(actor, node, action) | 36 or self.config.get_affiliation(actor, node, action) |
37 or "none"; | 37 or "none"; |
38 | 38 |
39 -- Check if node allows/forbids it | 39 -- Check if node allows/forbids it |
40 local node_capabilities = node_obj and node_obj.capabilities; | 40 local node_capabilities = node_obj and node_obj.capabilities; |
41 if node_capabilities then | 41 if node_capabilities then |
42 local caps = node_capabilities[node_aff or service_aff]; | 42 local caps = node_capabilities[node_aff or service_aff]; |
43 if caps then | 43 if caps then |
45 if can ~= nil then | 45 if can ~= nil then |
46 return can; | 46 return can; |
47 end | 47 end |
48 end | 48 end |
49 end | 49 end |
50 | 50 |
51 -- Check service-wide capabilities instead | 51 -- Check service-wide capabilities instead |
52 local service_capabilities = self.config.capabilities; | 52 local service_capabilities = self.config.capabilities; |
53 local caps = service_capabilities[node_aff or service_aff]; | 53 local caps = service_capabilities[node_aff or service_aff]; |
54 if caps then | 54 if caps then |
55 local can = caps[action]; | 55 local can = caps[action]; |
56 if can ~= nil then | 56 if can ~= nil then |
57 return can; | 57 return can; |
58 end | 58 end |
59 end | 59 end |
60 | 60 |
61 return false; | 61 return false; |
62 end | 62 end |
63 | 63 |
64 function service:set_affiliation(node, actor, jid, affiliation) | 64 function service:set_affiliation(node, actor, jid, affiliation) |
65 -- Access checking | 65 -- Access checking |
209 end | 209 end |
210 -- | 210 -- |
211 if self.nodes[node] then | 211 if self.nodes[node] then |
212 return false, "conflict"; | 212 return false, "conflict"; |
213 end | 213 end |
214 | 214 |
215 self.nodes[node] = { | 215 self.nodes[node] = { |
216 name = node; | 216 name = node; |
217 subscribers = {}; | 217 subscribers = {}; |
218 config = {}; | 218 config = {}; |
219 data = {}; | 219 data = {}; |