From edfa31a9eb164c9e1320b11bb7071d162c3efa2a Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 30 Nov 2012 12:14:31 +0100 Subject: [PATCH] Fix local users ACL --- .../templates/etc/ejabberd/ejabberd.cfg/18LocalUsers | 20 +++++++++++++++----- .../etc/ejabberd/ejabberd.cfg/20PubSubNodes | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/18LocalUsers b/root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/18LocalUsers index 1db7acc..6dce812 100644 --- a/root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/18LocalUsers +++ b/root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/18LocalUsers @@ -1,7 +1,17 @@ +% Local users { - $OUT =<<'HERE'; -% Local users: -{acl, local, {user_regexp, ""}}. - -HERE +use esmith::AccountsDB; +my $a = esmith::AccountsDB->open_ro(); +my $users; +foreach $u ($a->activeUsers()) { + $users .= ("\^" . $u->key() . '$|'); +} +if (defined $users) { + chop $users; + $OUT .= '{acl, local, {user_regexp,"'; + $OUT .= $users; + $OUT .= '"}}.'; + $OUT .= "\n"; +} +$OUT .= "\n"; } diff --git a/root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/20PubSubNodes b/root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/20PubSubNodes index a22b0df..27074ab 100644 --- a/root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/20PubSubNodes +++ b/root/etc/e-smith/templates/etc/ejabberd/ejabberd.cfg/20PubSubNodes @@ -1,7 +1,7 @@ { $OUT =<<'HERE'; % Only smeusers can create pubsub nodes -{access, pubsub_createnode, [{allow, smeusers}]}. +{access, pubsub_createnode, [{allow, local}]}. HERE }