1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mautrix_signal_ynh.git synced 2024-09-03 19:46:07 +02:00

trying store permissions

This commit is contained in:
Gredin 67 2023-01-08 21:55:20 +01:00
parent ea6d8f495b
commit d1fe7772be
5 changed files with 19 additions and 7 deletions

View file

@ -234,7 +234,7 @@ bridge:
# domain - All users on that homeserver
# mxid - Specific user
permissions:
"*": "relay"
"__RELAYUSERS__": "relay"
"__BOTUSERS__": "user"
"__BOTADMIN__": "admin"

View file

@ -162,16 +162,19 @@ services = ["__APP__"]
ask = "Users"
type = "tags"
visible = "role == 'user'"
bind = "permissions>__BOTUSERS__:__FINALPATH__/config.yaml"
[usermanagement.config.listadmin]
ask = "Admins"
type = "tags"
visible = "role == 'admin'"
bind = "permissions>__BOTADMIN__:__FINALPATH__/config.yaml"
[usermanagement.config.listrelay]
ask = "Relay users"
type = "tags"
visible = "role == 'relay'"
bind = "permissions>__RELAYUSERS:__FINALPATH__/config.yaml"
[usermanagement.config.role]
ask = "Role"

View file

@ -35,26 +35,26 @@ function get__encryption {
#=================================================
function get__listuser {
existingUsers=$(grep -- "\".*: user" "$final_path/config.yaml" | sed -r 's/: user//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',')
botusers=$(grep -- "\".*: user" "$final_path/config.yaml" | sed -r 's/: user//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',')
cat <<EOF
value: '$existingUsers'
value: '$botusers'
EOF
}
function get__listrelay {
existingRelayUsers=$(grep -- "\".*: relay" "$final_path/config.yaml" | sed -r 's/: relay//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',')
relayusers=$(grep -- "\".*: relay" "$final_path/config.yaml" | sed -r 's/: relay//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',')
cat <<EOF
value: '$existingRelayUsers'
value: '$relayusers'
EOF
}
function get__listadmin {
existingAdmins=$(grep -- "\".*: admin" "$final_path/config.yaml" | sed -r 's/: admin//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',')
botadmin=$(grep -- "\".*: admin" "$final_path/config.yaml" | sed -r 's/: admin//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',')
cat <<EOF
value: '$existingAdmins'
value: '$botadmin'
EOF
}

View file

@ -69,6 +69,7 @@ contact_list_names="disallow"
federate_rooms=true
encryption_default=false
print_level="INFO"
relayusers="*"
ynh_app_setting_set --app=$app --key=appserviceid --value=$appserviceid
ynh_app_setting_set --app=$app --key=displayname --value=$displayname
@ -83,6 +84,7 @@ ynh_app_setting_set --app=$app --key=contact_list_names --value=$contact_list_na
ynh_app_setting_set --app=$app --key=federate_rooms --value=$federate_rooms
ynh_app_setting_set --app=$app --key=encryption_default --value=$encryption_default
ynh_app_setting_set --app=$app --key=print_level --value=$print_level
ynh_app_setting_set --app=$app --key=relayusers --value=$relayusers
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS

View file

@ -50,6 +50,7 @@ contact_list_names=$(ynh_app_setting_get --app=$app --key=contact_list_names)
federate_rooms=$(ynh_app_setting_get --app=$app --key=federate_rooms)
encryption_default=$(ynh_app_setting_get --app=$app --key=encryption_default)
print_level=$(ynh_app_setting_get --app=$app --key=print_level)
relayusers=$(ynh_app_setting_get --app=$app --key=relayusers)
#=================================================
@ -160,6 +161,12 @@ then
ynh_app_setting_set --app=$app --key=print_level --value=$print_level
fi
if [ -z "$relayusers" ]
then
relayusers="*"
ynh_app_setting_set --app=$app --key=relayusers --value=$relayusers
fi
# Fix possible permission issues with a previous signald version, esp. with stickers
mkdir -p /var/lib/signald/{avatars,attachments,stickers}
chown $signald_user:$signald_user /var/lib/signald/{avatars,attachments,stickers}