ensure no user have obsolete login source

This commit is contained in:
Emmanuel Averty 2023-07-14 12:04:16 +02:00 committed by grosmanal
parent 4862bb6e82
commit 634b85bf36
4 changed files with 9 additions and 4 deletions

View file

@ -34,7 +34,7 @@ Brought to you by an inclusive community under the umbrella of Codeberg e.V., a
- Customize HTML templates, static files and many others.
**Shipped version:** 1.19.3-0~ynh3
**Shipped version:** 1.19.3-0~ynh4
## Screenshots

View file

@ -34,7 +34,7 @@ Brought to you by an inclusive community under the umbrella of Codeberg e.V., a
- Customize HTML templates, static files and many others.
**Version incluse :** 1.19.3-0~ynh3
**Version incluse :** 1.19.3-0~ynh4
## Captures décran
@ -61,4 +61,4 @@ ou
sudo yunohost app upgrade forgejo -u https://github.com/YunoHost-Apps/forgejo_ynh/tree/testing --debug
```
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>

View file

@ -5,7 +5,7 @@ name = "Forgejo"
description.en = "Lightweight software forge"
description.fr = "Forge logiciel légère"
version = "1.19.3-0~ynh3"
version = "1.19.3-0~ynh4"
maintainers = ["Emmanuel Averty"]

View file

@ -32,6 +32,11 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
pushd "$install_dir"
old_login_source_id=$(ynh_exec_as $app ./forgejo admin auth list | grep "YunoHost LDAP" | grep "via BindDN" | cut -f 1)
if [ ! -z $old_login_source_id ]; then
ynh_print_info --message="Delete obsolete forgejo login source (LDAP via BindDN)"
# Ensure no user have this obsolete login source
ynh_psql_execute_as_root --database $db_name --sql "update public.user set login_source = 0, login_type = 0 where login_source = ${old_login_source_id}"
# Delete old login source
ynh_exec_as $app ./forgejo admin auth delete --id $old_login_source_id