1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/airsonic_ynh.git synced 2024-09-03 18:06:14 +02:00

new permission system

This commit is contained in:
Kay0u 2019-11-20 21:20:00 +09:00
parent c19be1fb0a
commit 9b317d89b4
No known key found for this signature in database
GPG key ID: 7FF262C033518333
3 changed files with 13 additions and 40 deletions

View file

@ -2,9 +2,9 @@
LdapEnabled=true
LdapUrl=ldap://localhost:389/ou=users,dc=yunohost,dc=org
LdapSearchFilter=(uid={0})
#LdapManagerDn=
#LdapManagerPassword=
LdapSearchFilter=(&(|(objectclass=posixAccount))(uid={0})(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))
LdapManagerDn=
LdapManagerPassword=
# Automatically create users comming from Yunohost in Airsonic
LdapAutoShadowing=true
GettingStartedEnabled=false

View file

@ -49,7 +49,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#=================================================
# STANDARD MODIFICATIONS
@ -167,6 +166,8 @@ ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target
# Copy configuration file of airsonic
cp ../conf/airsonic.properties $final_path/airsonic.properties
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file="$final_path/airsonic.properties"
#=================================================
# STORE THE CONFIG FILES CHECKSUM
#=================================================
@ -212,10 +213,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Set the app as temporarily public for curl call
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
# Reload SSOwat config
yunohost app ssowatconf
ynh_permission_update --permission "main" --remove "all_users" --add "visitors"
# Reload Nginx
ynh_systemd_action --service_name=nginx --action=reload
@ -250,7 +248,7 @@ ynh_local_curl "/rest/createUser.view" "u=admin" "t=$token" "s=$salt" "username=
# Remove the public access
if [ $is_public -eq 0 ]
then
ynh_app_setting_delete --app=$app --key=skipped_uris
ynh_permission_update --permission "main" --remove "visitors" --add "all_users"
fi
#=================================================
@ -266,18 +264,6 @@ ynh_script_progression --message="Restarting a systemd service..." --weight=12
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=2
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -35,13 +35,9 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
# If is_public exists, remove it
if [ ! -z $is_public ]; then
ynh_app_setting_delete --app=$app --key=is_public
fi
# If final_path doesn't exist, create it
@ -175,6 +171,9 @@ ynh_backup_if_checksum_is_different --file="$final_path/airsonic.properties"
cp ../conf/airsonic.properties $final_path/airsonic.properties
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file="$final_path/airsonic.properties"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/airsonic.properties"
@ -212,18 +211,6 @@ ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target
# Set permissions on app files
chown -R $app: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
#=================================================
# START SYSTEMD SERVICE
#=================================================