comparison psgxs.js @ 7:781ac4f1e304

Allow others JIDs than super-owners to create nodes.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 26 Aug 2010 23:43:45 +0200
parents 2bcadb0531f4
children efe8dbd34780
comparison
equal deleted inserted replaced
6:2bcadb0531f4 7:781ac4f1e304
687 if (storage.existsNode(nodeID)) 687 if (storage.existsNode(nodeID))
688 return makeError(response, errors.nodeid_already_exists.n); 688 return makeError(response, errors.nodeid_already_exists.n);
689 689
690 var bare = toBareJID(to); 690 var bare = toBareJID(to);
691 var right = false; 691 var right = false;
692
693 // Check for super-owner
692 for (var i in config.owner) 694 for (var i in config.owner)
693 if (config.owner[i] == bare) 695 if (config.owner[i] == bare)
696 right = true;
697
698 // Check for authorized user
699 for (var i in config.allowCreateNode)
700 if (config.allowCreateNode[i].exec(bare))
694 right = true; 701 right = true;
695 702
696 if (!right) 703 if (!right)
697 return makeError(response, errors.forbidden.n); 704 return makeError(response, errors.forbidden.n);
698 705