From 03643d342ed542a025cb2d69a5cb15a2dc15d458 Mon Sep 17 00:00:00 2001 From: Emmanuel Averty Date: Sun, 25 Jun 2023 18:48:03 +0200 Subject: [PATCH] add ask strings for init_admin_permission --- manifest.toml | 6 ++++-- scripts/_common.sh | 6 ++++++ scripts/install | 5 +---- scripts/upgrade | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/manifest.toml b/manifest.toml index 0a766fb..2841ac3 100644 --- a/manifest.toml +++ b/manifest.toml @@ -39,8 +39,10 @@ ram.runtime = "2G" default = "visitors" [install.init_admin_permission] - help.en = "Users of this group should have access to Forgejo admin page (but the won't : see application description in yunohost admin)" - help.fr = "Les utilisateurs de ce groupe devrait avoir accès à la page d'administration de Forgejo (mais cela ne fonctionne pas : voir la description de l'application dans l'administration de yunohost" + ask.en = "Which group will have access to forgejo admin page (broken feature : see appliction description)" + ask.fr = "Quel groupe aura accès à l'administration de forgejo (ne fonctionne pas : voir la description de l'application)" + help.en = "Users of this group should have access to Forgejo admin page" + help.fr = "Les utilisateurs de ce groupe devrait avoir accès à la page d'administration de Forgejo" type = "group" default = "admins" diff --git a/scripts/_common.sh b/scripts/_common.sh index 459c90f..a548f93 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,3 +3,9 @@ #================================================= # SET ALL CONSTANTS #================================================= + +function set_forgejo_login_source() { + pushd "$install_dir" + ynh_exec_as $app ./forgejo admin auth add-ldap-simple --security-protocol "Unencrypted" --name "YunoHost LDAP" --host "localhost" --port "389" --skip-tls-verify --user-search-base "ou=users,dc=yunohost,dc=org" --user-dn "uid=%s,ou=Users,dc=yunohost,dc=org" --user-filter "(&(objectclass=posixAccount)(uid=%s)(permission=cn=$app.main,ou=permission,dc=yunohost,dc=org))" --admin-filter "(permission=cn=forgejo.admin,ou=permission,dc=yunohost,dc=org)" --username-attribute "uid" --firstname-attribute "givenName" --surname-attribute "sn" --email-attribute "mail" + popd +} \ No newline at end of file diff --git a/scripts/install b/scripts/install index 62ec90e..243cd0f 100644 --- a/scripts/install +++ b/scripts/install @@ -97,10 +97,7 @@ ynh_add_fail2ban_config --logpath "/var/log/$app/forgejo.log" --failregex ".*Fai # LDAP CONFIGURATION #================================================= ynh_script_progression --message="Adding LDAP configuration..." --weight=1 - -pushd "$install_dir" - ynh_exec_as $app ./forgejo admin auth add-ldap-simple --security-protocol "Unencrypted" --name "YunoHost LDAP" --host "localhost" --port "389" --skip-tls-verify --user-search-base "ou=users,dc=yunohost,dc=org" --user-dn "uid=%s,ou=Users,dc=yunohost,dc=org" --user-filter "(&(objectclass=posixAccount)(uid=%s)(permission=cn=$app.main,ou=permission,dc=yunohost,dc=org))" --admin-filter "(permission=cn=forgejo.admin,ou=permission,dc=yunohost,dc=org)" --username-attribute "uid" --firstname-attribute "givenName" --surname-attribute "sn" --email-attribute "mail" -popd +set_forgejo_login_source #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 8eb2520..3ed1fea 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -36,7 +36,7 @@ pushd "$install_dir" ynh_exec_as $app ./forgejo admin auth delete --id $old_login_source_id # Create new login source - ynh_exec_as $app ./forgejo admin auth add-ldap-simple --security-protocol "Unencrypted" --name "YunoHost LDAP" --host "localhost" --port "389" --skip-tls-verify --user-search-base "ou=users,dc=yunohost,dc=org" --user-dn "uid=%s,ou=Users,dc=yunohost,dc=org" --user-filter "(&(objectclass=posixAccount)(uid=%s)(permission=cn=$app.main,ou=permission,dc=yunohost,dc=org))" --admin-filter "(permission=cn=forgejo.admin,ou=permission,dc=yunohost,dc=org)" --username-attribute "uid" --firstname-attribute "givenName" --surname-attribute "sn" --email-attribute "mail" + set_forgejo_login_source fi popd