# HG changeset patch # User Emmanuel Gil Peyrot # Date 1282859025 -7200 # Node ID 781ac4f1e304d5c8d638b339932062d9babb4907 # Parent 2bcadb0531f422e1e4373c451c51210fadcf8e50 Allow others JIDs than super-owners to create nodes. diff --git a/configuration.js b/configuration.js --- a/configuration.js +++ b/configuration.js @@ -24,6 +24,7 @@ config.password = 'hellohello'; config.superOwner = ['you@example.com']; config.version = '0.1'; config.os = 'GNU/Linux'; +config.allowCreateNode = [/@example\.com$/]; // value is an array of RegExp JIDs. If only super-owner should be able to create nodes, use []. config.activated = [ //'access-authorize', diff --git a/psgxs.js b/psgxs.js --- a/psgxs.js +++ b/psgxs.js @@ -689,10 +689,17 @@ function onIq(stanza) { var bare = toBareJID(to); var right = false; + + // Check for super-owner for (var i in config.owner) if (config.owner[i] == bare) right = true; + // Check for authorized user + for (var i in config.allowCreateNode) + if (config.allowCreateNode[i].exec(bare)) + right = true; + if (!right) return makeError(response, errors.forbidden.n);