sulu: fix faulty ACL generation logic

Also remove leftovers from QR code generation and pointless uci_load
This commit is contained in:
Erik Karlsson 2025-10-03 10:15:00 +02:00
parent 57ef92af9a
commit 91dced7427

View file

@ -4,7 +4,6 @@
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
#. /lib/functions/iopsys-environment.sh
RESTART_REQ=0
_RESTART_SERVICES="0"
@ -170,18 +169,20 @@ _create_mosquitto_acl() {
users="$(_get_sulu_user_roles)"
if [ -f "${ACL_FILE}" ]; then
acl_users="$(awk '/^user/ {print $2}' "${ACL_FILE}")"
for user in ${users}; do
if ! grep -q "$user" "${acl_users}"; then
acl_users="$(awk '/^user / {print $2}' "${ACL_FILE}")"
for user in ${acl_users}; do
if ! echo "$users" | grep -qwF "$user"; then
rm -f "${ACL_FILE}"
RESTART_REQ="1"
break
fi
done
fi
touch "${ACL_FILE}"
[ -f "${ACL_FILE}" ] || touch "${ACL_FILE}"
agentid="$(_get_agent_id)"
for user in ${users}; do
if ! grep -q "user $user" "${ACL_FILE}"; then
if ! grep -qxF "user $user" "${ACL_FILE}"; then
{
echo "user ${user}"
echo "topic read /usp/${agentid}/${user}/controller/reply-to"
@ -200,9 +201,7 @@ _create_mosquitto_acl() {
}
update_obuspa_config() {
RESTART_REQ=0
uci_load obuspa
_update_obuspa_config_rbac
uci_commit obuspa
@ -218,7 +217,7 @@ configure_sulu() {
generate_sulu_conn_config
}
while getopts ":rq" opt; do
while getopts ":r" opt; do
case ${opt} in
r)
_RESTART_SERVICES="1"