Comments (5)
@bp91 Actually the mod_admin_extra
is not activated by default (at least until #187), so for using shared roster groups you need to additionally set EJABBERD_MOD_ADMIN_EXTRA
to true
. After merging #187 using of the special directive @all@
will be available in the following format:
DIRECTIVE@VIRTUALHOST:GROUPNAME@VIRTUALHOST
For example:
EJABBERD_GROUP_MEMBERS=@all@@example.com:[email protected]
from docker-ejabberd.
Hi @youmad, I found a parsing error into the script 30_ejabberd_setup_groups.sh, in the methods register_group_member
and register_all_group_members
:
register_group_member() {
local user=$1
local host=$2
local group=$3
local grouphost=$4
echo "Adding ${user} ${host} to roster group ${group}@${grouphost}"
# Do not exit if user is already a member
${EJABBERDCTL} srg_user_add ${user} ${host} ${group} ${grouphost} || true
}
register_all_group_members() {
# register shared roster group members from environment $EJABBERD_GROUP_MEMBERS
# Use whitespace to seperate groups.
#
# sample:
# - add two users to groups:
# -e "[email protected]:[email protected] [email protected]:[email protected]"
for member in ${EJABBERD_GROUP_MEMBERS} ; do
local user=${member%%:*}
local group=${member#*:}
if [ $user = @all@ ]
then
local username=@all@
local userhost=${user#*@}
else
local username=${user%%@*}
local userhost=${user#*@}
fi
local groupname=${group%%@*}
local grouphost=${group#*@}
echo 'user: ' $user
echo 'group: ' $group
echo 'username: ' $username
echo 'userhost: ' $userhost
echo 'groupname: ' $groupname
echo 'grouphost: ' $grouphost
register_group_member ${username} ${userhost} ${groupname} ${grouphost}
done
}
The problem now is solved, I don't know if you want to insert this in the repo. I can close. Thanks.
from docker-ejabberd.
@bp91 similar corrections are present here: https://github.com/rroemhild/docker-ejabberd/pull/187/files#diff-c60c65c4756d6a1b70d29ddcd05e8728
from docker-ejabberd.
Great, in register_all_group_members()
should be local username=${user%%@*}
instead of local username=${user%@*}
. Thanks again
from docker-ejabberd.
With ${user%%@*}
it doesn't match @all@
directive:
$ cat test.sh
#!/bin/bash
set -e
register_all_group_members() {
echo '----------'
for member in ${EJABBERD_GROUP_MEMBERS} ; do
local user=${member%%:*}
local group=${member#*:}
local username=${user%%@*}
local userhost=${user##*@}
local groupname=${group%@*}
local grouphost=${group##*@}
echo 'username: ' $username
echo 'userhost: ' $userhost
echo 'groupname: ' $groupname
echo 'grouphost: ' $grouphost
echo '----------'
done
}
register_all_group_members
exit 0
$ EJABBERD_GROUP_MEMBERS='[email protected]:[email protected] [email protected]:[email protected] @all@@example.com:[email protected]' ./test.sh
----------
username: user
userhost: xmpp.kx.gd
groupname: group
grouphost: xmpp.kx.gd
----------
username: user2
userhost: xmpp.kx.gd
groupname: group
grouphost: xmpp.kx.gd
----------
username:
userhost: example.com
groupname: group
grouphost: example.com
----------
with local username=${user%@*}
it does:
$ cat test.sh
#!/bin/bash
set -e
register_all_group_members() {
echo '----------'
for member in ${EJABBERD_GROUP_MEMBERS} ; do
local user=${member%%:*}
local group=${member#*:}
local username=${user%@*}
local userhost=${user##*@}
local groupname=${group%@*}
local grouphost=${group##*@}
echo 'username: ' $username
echo 'userhost: ' $userhost
echo 'groupname: ' $groupname
echo 'grouphost: ' $grouphost
echo '----------'
done
}
register_all_group_members
exit 0
$ EJABBERD_GROUP_MEMBERS='[email protected]:[email protected] [email protected]:[email protected] @all@@example.com:[email protected]' ./test.sh
----------
username: user
userhost: xmpp.kx.gd
groupname: group
grouphost: xmpp.kx.gd
----------
username: user2
userhost: xmpp.kx.gd
groupname: group
grouphost: xmpp.kx.gd
----------
username: @all@
userhost: example.com
groupname: group
grouphost: example.com
----------
from docker-ejabberd.
Related Issues (20)
- p1_rand is not available (UndefinedFunctionError)
- Custom Module HOT 1
- Can't access admin :5280/admin HOT 2
- Cannot access API with browser show not found HOT 1
- Kubernetes working example HOT 8
- SSL more env vars
- 18.09 tag HOT 1
- Not listening to any connection HOT 3
- Open relay HOT 5
- Keeping a CHANGELOG would be nice! HOT 2
- Getting issue with file upload HOT 1
- PostgreSQL support for auth script
- Can't connect to web admin
- setting ERLANG_NODE crashes docker container HOT 1
- dotenv and python
- Support for http auth method HOT 1
- How to do a Select on Erlang, Mnesia
- conf/ejabberd.yml.tpl seems to be outdated
- Provide tags for newer ejabberd versions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-ejabberd.