Comparison

util/pubsub.lua @ 8809:6cba2df3817c

util.pubsub: Don't record the superuser as owner on creation No need to be set as owner, it has all privileges anyways. Since it’s a boolean instead of a string, its presence may cause weirdness in other code expecting all affiliations to be string JIDs.
author Kim Alvefur <zash@zash.se>
date Sun, 20 May 2018 03:27:02 +0200
parent 8694:059183e5571e
child 8810:9f8a746f99c1
comparison
equal deleted inserted replaced
8808:40a7135eb6ac 8809:6cba2df3817c
258 end 258 end
259 end 259 end
260 260
261 self.data[node] = self.config.itemstore(self.nodes[node].config, node); 261 self.data[node] = self.config.itemstore(self.nodes[node].config, node);
262 self.events.fire_event("node-created", { node = node, actor = actor }); 262 self.events.fire_event("node-created", { node = node, actor = actor });
263 local ok, err = self:set_affiliation(node, true, actor, "owner"); 263 if actor ~= true then
264 if not ok then 264 local ok, err = self:set_affiliation(node, true, actor, "owner");
265 self.nodes[node] = nil; 265 if not ok then
266 self.data[node] = nil; 266 self.nodes[node] = nil;
267 return ok, err; 267 self.data[node] = nil;
268 end 268 return ok, err;
269 269 end
270 return ok, err; 270 end
271
272 return true;
271 end 273 end
272 274
273 function service:delete(node, actor) 275 function service:delete(node, actor)
274 -- Access checking 276 -- Access checking
275 if not self:may(node, actor, "delete") then 277 if not self:may(node, actor, "delete") then