Updates to Allow/White List handling (#359)
This commit is contained in:
1 parent
f2a4dbd2cb
commit
db8546ef25
1 file changed
+9
-8
+9
-8
@@ -165,23 +165,24 @@ if [ -n "$OPS" ] || [ -n "$MEMBERS" ] || [ -n "$VISITORS" ]; then
|
||||
]| flatten' > permissions.json
|
||||
fi
|
||||
|
||||
if [[ -n "$ALLOW_LIST_USERS" || -n "$WHITE_LIST_USERS" ]]; then
|
||||
allowListUsers=${ALLOW_LIST_USERS:-$WHITE_LIST_USERS}
|
||||
|
||||
if [[ -v ALLOW_LIST_USERS || -v WHITE_LIST_USERS ]]; then
|
||||
allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}}
|
||||
|
||||
WHITE_LIST=false
|
||||
rm -f whitelist.json
|
||||
if [[ $allowListUsers ]]; then
|
||||
if [[ "$allowListUsers" ]]; then
|
||||
echo "Setting allow list"
|
||||
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "allowlist.json"
|
||||
# activate server property to enable list usage
|
||||
ALLOW_LIST=true
|
||||
else
|
||||
rm -rf allowlist.json
|
||||
ALLOW_LIST=false
|
||||
rm -f allowlist.json
|
||||
fi
|
||||
export WHITE_LIST ALLOW_LIST
|
||||
else
|
||||
ALLOW_LIST=false
|
||||
rm -f allowlist.json
|
||||
fi
|
||||
sed -i '/^white-list=.*/d' server.properties #Removes white-list= line from server.properties
|
||||
export ALLOW_LIST
|
||||
|
||||
set-property --file server.properties --bulk /etc/bds-property-definitions.json
|
||||
|
||||
|
||||
Reference in new issue
Block a user