Add allow an access to git command if the app is not public

This commit is contained in:
Josué Tille 2019-10-26 22:53:02 +02:00
parent 10e8930fab
commit 3e148db281
No known key found for this signature in database
GPG Key ID: 716A6C99B04194EF
2 changed files with 6 additions and 11 deletions

View File

@ -56,9 +56,13 @@
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public site ?",
"en": "Is it a public site ? ",
"fr": "Est-ce un site public ?"
},
"help": {
"en": "A public server means that everybody is able to access to the pain page of the forge, on the public profile of the user and on the public repository. But you still can limit the access to each repository if you set it as private. Note that to be able to use the remote git command (clone, pull, push) with http and to use the API by (by example with a smartphone), you need to set this application as public.",
"fr": "Un serveur publique signifie que n'importe qui peut accéder à la page principale de la forge, au profil publique des utilisateur et au dépots publiques Mais vous pouvez définir les dépot en tant que privé. Notez que pour pouvoir utiliser les commandes git distante (clone, pull, push) avec http et pour pouvoir utiliser l'API (par exemple avec un smartphone), vous devez mettre cette application en tant que publique."
},
"default": true
}
]

View File

@ -91,15 +91,6 @@ set_access_settings() {
then
ynh_app_setting_set --app $app --key unprotected_uris --value "/"
else
# For an access to the git server by https in private mode we need to allow the access to theses URL :
# - "DOMAIN/PATH/USER/REPOSITORY/info/refs"
# - "DOMAIN/PATH/USER/REPOSITORY/git-upload-pack"
# - "DOMAIN/PATH/USER/REPOSITORY/git-receive-pack"
excaped_domain=${domain//'.'/'%.'}
excaped_domain=${excaped_domain//'-'/'%-'}
excaped_path=${path_url//'.'/'%.'}
excaped_path=${excaped_path//'-'/'%-'}
ynh_app_setting_set --app $app --key skipped_regex --value "$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-receive%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-upload%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/info/refs"
ynh_app_setting_delete --app $app --key skipped_regex
fi
}