1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/listmonk_ynh.git synced 2024-09-03 19:36:15 +02:00

remove admin/pwd

This commit is contained in:
navanchauhan 2022-12-27 17:11:31 -05:00
parent a7a0c85ab4
commit f0773968d1
3 changed files with 21 additions and 12 deletions

View file

@ -9,8 +9,8 @@ address = "127.0.0.1:__PORT__"
# be replaced with a better multi-user, role-based authentication system.
# IMPORTANT: Leave both values empty to disable authentication on admin
# only where an external authentication is already setup.
admin_username = "__ADMIN__"
admin_password = "__PASSWORD__"
admin_username = ""
admin_password = ""
# Database.
[db]

View file

@ -28,8 +28,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
admin=""
password=""
app=$YNH_APP_INSTANCE_NAME
@ -209,12 +209,12 @@ then
fi
# Only the admin can access the admin panel of the app (if the app has an admin panel)
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin --auth_header=false
ynh_permission_create --permission="admin" --url="/admin" --additional_urls="/admin /api" --allowed=$admin --auth_header=false
# Everyone can access the API part
# We don't want to display the tile in the SSO so we put --show_tile="false"
# And we don't want the YunoHost admin to be able to remove visitors group to this permission, so we put --protected="true"
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
ynh_permission_create --permission="api" --url="/public" --additional_urls="/api/public" --allowed="visitors" --show_tile="false" --protected="true"
#=================================================
# RELOAD NGINX

View file

@ -70,14 +70,23 @@ fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin --auth_header=false
ynh_permission_create --permission="admin" --url="/admin" --additional_urls="/admin /api" --allowed=$admin --auth_header=false
fi
# Create a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
ynh_permission_create --permission="api" --url="/public" --additional_urls="/api/public" --allowed="visitors" --show_tile="false" --protected="true"
fi
if ynh_compare_current_package_version --comparison le --version 2.3.0~ynh1
ynh_permission_delete --permission="admin"
ynh_permission_delete --permission="api"
ynh_permission_create --permission="admin" --url="/admin" --additional_urls="/admin /api" --allowed=$admin --auth_header=false
ynh_permission_create --permission="api" --url="/public" --additional_urls="/api/public" --allowed="visitors" --show_tile="false" --protected="true"
then
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -144,12 +153,12 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# UPDATE A CONFIG FILE
#=================================================
# ynh_script_progression --message="Updating a configuration file..." --time --weight=1
ynh_script_progression --message="Updating a configuration file..." --time --weight=1
# ynh_add_config --template="../conf/config.toml" --destination="$final_path/config.toml"
ynh_add_config --template="../conf/config.toml" --destination="$final_path/config.toml"
# chmod 400 "$final_path/config.toml"
# chown $app:$app "$final_path/config.toml"
chmod 400 "$final_path/config.toml"
chown $app:$app "$final_path/config.toml"
#=================================================
# DATABASE CONFIGURATION