mirror of
https://github.com/YunoHost/doc.git
synced 2024-09-03 20:06:26 +02:00
Merge 3188adec97
into 035b61f52e
This commit is contained in:
commit
797f676717
3 changed files with 874 additions and 94 deletions
|
@ -0,0 +1,516 @@
|
|||
---
|
||||
title: Format des arguments Yunohost
|
||||
template: docs
|
||||
taxonomy:
|
||||
category: docs
|
||||
routes:
|
||||
default: '/packaging_apps_arguments_format'
|
||||
---
|
||||
|
||||
Dans le développement d'applications YunoHost, il y a plusieurs endroits où vous pouvez écrire des questions pour votre
|
||||
utilisateur comme dans `manifest.json/toml`, `config_panel.json/toml` ou `actions.json/toml`.
|
||||
|
||||
Cette page documente ce format et tous les types de questions disponibles que vous pouvez poser à votre utilisateur.
|
||||
Sauf indication contraire, ce format s'applique partout où il est utilisable ( à l'heure actuelle :
|
||||
les arguments d'installation dans `manifest.json/toml`, `config_panel.json/toml` et `actions.json/toml`)
|
||||
|
||||
Pour aider à la comprehension, les titres sont en français.i Cependant dans le code toml ou javascript,
|
||||
le type doit être en anglais (comme dans les exemples).
|
||||
|
||||
## Format général des arguments Yunohost
|
||||
|
||||
The general format for an argument looks like this:
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "one_of_the_available_type"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
help.en = "some help text in english" # optional
|
||||
help.fr = "un peu d aide en français" # optional
|
||||
example = "an example value" # optional
|
||||
default = "some stuff" # optional, not available for all types
|
||||
optional = true # optional, will skip if not answered
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "one_of_the_available_type", // "sting" is not specified
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"help": {
|
||||
"en": "some help text in english",
|
||||
"fr": "un peu d aide en français"
|
||||
},
|
||||
"example": "an example value", // optional
|
||||
"default", "some stuff", // optional, not available for all types
|
||||
"optional": true // optional, will skip if not answered
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
## Tous les types disponibles
|
||||
|
||||
### Chaîne de caractères
|
||||
|
||||
C'est le type le plus simple et le type par défaut si vous n'en spécifiez pas.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "string" # optional
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
example = "an example value" # optional
|
||||
default = "some stuff" # optional
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "string", // optional
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"default": "some stuff", // optional
|
||||
"example": "an example value"
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Chaîne de caractères avec choix
|
||||
|
||||
Comme la chaine de caractères, sauf que l'utilisateur doit choisir dans une liste de chaîne de caractères spécifiques.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "string"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
example = "an example value" # optional
|
||||
choices = ["fr", "en"]
|
||||
default = "en" # optional
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"example": "Un exemple de valeur",
|
||||
"choices": ["fr", "en"],
|
||||
"default": "en" // optionel
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Nombre
|
||||
|
||||
Comme le type chaîne de caractères (en anglais: `string`) mais uniquement pour les nombres.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "number"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
default = 0
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "number",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"default": 0
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Domaine
|
||||
|
||||
Ce type demandera à l'utilisateur de choisir l'un des domaines de son instance YunoHost.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "domain"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Chemin (en: Path)
|
||||
|
||||
Ce type demandera à l'utilisateur de choisir le chemin de l'url (généralement pour arriver à un domaine)
|
||||
comme "chemin/vers/mon/application"
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "path"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
default = "/my_app"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"default": "/my_app"cd
|
||||
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Utilisateur
|
||||
|
||||
Ce type demandera à l'utilisateur de selectionner un utilisateur dans la liste des utilisateurs
|
||||
de son instance Yunohost. Généralement, cela est utilisé pour sélectionner celui qui va être l'administrateur
|
||||
ou qui va avoir accès à cette application.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "user"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Mot de passe
|
||||
|
||||
Ce type demande à l'utilisateur de saisir un mot de passe.
|
||||
Celui-ci est généralement utilisé pour saisir le mot de passe permettant
|
||||
de créer un compte sur l'application.
|
||||
|
||||
En ligne de command, il s comporte comme n'importe quelle demande de mot de passe
|
||||
et n'affichera aucun caractère (pas de "\*\*\*...") pour des questions de sécurité.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "password"
|
||||
ask.en = "the password"
|
||||
ask.fr = "le mot de passe"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "the password",
|
||||
"fr": "le mot de passe"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Booléen
|
||||
Ce type demande à l'utilisateur de répondre à question par Vrais ou Faux
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "boolean"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
default = true
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Application
|
||||
|
||||
Ce type demande à l'utilisateur de selectionner une application dans la liste
|
||||
des apllications installées sur l'instance Yunohost.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "app"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "app",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Information
|
||||
|
||||
C'est un type spécial qui permet au packageur de l'application à écrire un text
|
||||
qui est simplement affiché. C'est utile pour spécifier un peu le context.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "display_text"
|
||||
ask.en = "the text in english"
|
||||
ask.fr = "le text en français"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "display_text",
|
||||
"ask": {
|
||||
"en": "the text in english",
|
||||
"fr": "le text en français"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Plage de valeurs
|
||||
|
||||
Ce type demande à l'utilisateur de choisir une valeur numérique entre de bornes.
|
||||
Une valeur précise n'est cependant pas concidérée comme importante.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "email"
|
||||
ask.en = "Put a range"
|
||||
ask.fr = "Indiquer "
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "email",
|
||||
"ask": {
|
||||
"en": "the email address",
|
||||
"fr": "l adresse courriel"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Adresse courriel (email)
|
||||
|
||||
Ce type demande à l'utilisateur de renseigner une adresse courriel.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "email"
|
||||
ask.en = "the email address"
|
||||
ask.fr = "l adresse courriel"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "email",
|
||||
"ask": {
|
||||
"en": "the email address",
|
||||
"fr": "l adresse courriel"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Url
|
||||
|
||||
Ce type demande à l'utilisateur de renseigner une url.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "email"
|
||||
ask.en = "the url"
|
||||
ask.fr = "l url"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "url",
|
||||
"ask": {
|
||||
"en": "the url",
|
||||
"fr": "l url"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Date
|
||||
Ce type demande à l'utilisateur de renseigner une date.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "date"
|
||||
ask.en = "the date"
|
||||
ask.fr = "la date "
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "date",
|
||||
"ask": {
|
||||
"en": "the date",
|
||||
"fr": "la date"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Temps | Horaire
|
||||
|
||||
Ce type demande à l'utilisateur de renseigner un horaire.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "time"
|
||||
ask.en = "time"
|
||||
ask.fr = "l horaire"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "date",
|
||||
"ask": {
|
||||
"en": "time",
|
||||
"fr": "l horaire"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Fichier
|
||||
|
||||
Ce type demande à l'utilisateur d'ajouter un fichier.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = file""
|
||||
ask.en = "the file"
|
||||
ask.fr = "le fichier"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "file",
|
||||
"ask": {
|
||||
"en": "the file",
|
||||
"fr": "le fichier"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
|
@ -18,78 +18,80 @@ usable (for now: installation arguments in `manifest.json/toml`,
|
|||
|
||||
## YunoHost arguments general format
|
||||
|
||||
The general format for an argument looks like this in toml:
|
||||
|
||||
The general format for an argument looks like this:
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "one_of_the_available_type"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "the question in french"
|
||||
ask.fr = "la question en français"
|
||||
help.en = "some help text in english" # optional
|
||||
help.fr = "some help text in french" # optional
|
||||
help.fr = "un peu d aide en français" # optional
|
||||
example = "an example value" # optional
|
||||
default = "some stuff" # optional, not available for all types
|
||||
optional = true # optional, will skip if not answered
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "one_of_the_available_type", // "sting" is not specified
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"help": {
|
||||
"en": "some help text in english",
|
||||
"fr": "some help text in french"
|
||||
"fr": "un peu d aide en français"
|
||||
},
|
||||
"example": "an example value", // optional
|
||||
"default", "some stuff", // optional, not available for all types
|
||||
"optional": true // optional, will skip if not answered
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
## All avaiable types
|
||||
|
||||
### string
|
||||
### String
|
||||
|
||||
This one is the simpliest one and is the default type if you don't specify one.
|
||||
|
||||
Example in toml:
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "string" # optional
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "the question in french"
|
||||
ask.fr = "la question en français"
|
||||
example = "an example value" # optional
|
||||
default = "some stuff" # optional
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "string", // optional
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"default": "some stuff", // optional
|
||||
"example": "an example value"
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### string with choices
|
||||
### String with choices
|
||||
|
||||
Like string except the user needs to chose in a list of specifics strings.
|
||||
|
||||
Example in toml:
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "string"
|
||||
|
@ -99,77 +101,110 @@ example = "an example value" # optional
|
|||
choices = ["fr", "en"]
|
||||
default = "en" # optional
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"example": "an example value",
|
||||
"choices": ["fr", "en"],
|
||||
"default": "en" // optional
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
### Number
|
||||
|
||||
### domain
|
||||
|
||||
This type will ask the user to chose one of the domains of their YunoHost instance.
|
||||
Like string except the user needs to enter a number
|
||||
|
||||
Example in toml:
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "number"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "la question en français"
|
||||
default = 0
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "number",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"default": 0
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
|
||||
### Domain
|
||||
|
||||
This type will ask the user to chose one of the domains of their YunoHost instance.
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "domain"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "the question in french"
|
||||
ask.fr = "la question en français"
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
"fr": "la question en français"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Path
|
||||
|
||||
This type will ask the user to chose an URL path (generally to happen it to a
|
||||
domain) like "/path/to/my/app"
|
||||
|
||||
Example in toml:
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "path"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "the question in french"
|
||||
ask.fr = "la question en français"
|
||||
default = "/my_app"
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"default": "/my_app"
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### User
|
||||
|
||||
|
@ -178,26 +213,29 @@ YunoHost installation. Generally this is used to select who is going to be the
|
|||
admin or who is going to have access to this application.
|
||||
|
||||
Example in toml:
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "user"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "the question in french"
|
||||
ask.fr = "la question en français"
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
"fr": "la question en français"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Password
|
||||
|
||||
|
@ -208,82 +246,60 @@ In CLI it will behave like any password query and won't print any character on
|
|||
type (not "\*\*\*...") for security reasons.
|
||||
|
||||
Example in toml:
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "password"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "the question in french"
|
||||
ask.fr = "la question en français"
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
"fr": "la question en français"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Boolean
|
||||
|
||||
This type will ask the user to answer true or false to a question.
|
||||
|
||||
Example in toml:
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "boolean"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "the question in french"
|
||||
ask.fr = "la question en français"
|
||||
default = true
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
"fr": "la question en français"
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
```
|
||||
|
||||
### Number
|
||||
|
||||
Like string except the user needs to enter a number
|
||||
|
||||
Example in toml:
|
||||
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "number"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "the question in french"
|
||||
default = 0
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "number",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
},
|
||||
"default": 0
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### App
|
||||
|
||||
|
@ -291,48 +307,211 @@ This type will ask the user to select an application in the list of installed
|
|||
application on their YunoHost.
|
||||
|
||||
Example in toml:
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "app"
|
||||
ask.en = "the question in english"
|
||||
ask.fr = "the question in french"
|
||||
ask.fr = "la question en français"
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "app",
|
||||
"ask": {
|
||||
"en": "the question in english",
|
||||
"fr": "the question in french"
|
||||
"fr": "la question en français"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### display_text
|
||||
### Display text
|
||||
|
||||
This is a special type that allows the application packager to write some text
|
||||
that will be simply displayed. This is useful to provide more context.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "display_text"
|
||||
ask.en = "the text in english"
|
||||
ask.fr = "the text in french"
|
||||
ask.fr = "le text en français"
|
||||
```
|
||||
|
||||
And in json:
|
||||
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "display_text",
|
||||
"ask": {
|
||||
"en": "the text in english",
|
||||
"fr": "the text in french"
|
||||
"fr": "le text en français"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Range
|
||||
This type will ask the user to specify a numeric value between two terminals.
|
||||
Te precise value, however, is not considered important.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "email"
|
||||
ask.en = "Put a range"
|
||||
ask.fr = "Indiquer "
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "email",
|
||||
"ask": {
|
||||
"en": "the email address",
|
||||
"fr": "l adresse courriel"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Email
|
||||
This type will ask the user to input a email address.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "email"
|
||||
ask.en = "the email address"
|
||||
ask.fr = "l adresse courriel"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "email",
|
||||
"ask": {
|
||||
"en": "the email address",
|
||||
"fr": "l adresse courriel"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Url
|
||||
This type will ask the user to input a url.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "email"
|
||||
ask.en = "the url"
|
||||
ask.fr = "l url"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "url",
|
||||
"ask": {
|
||||
"en": "the url",
|
||||
"fr": "l url"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Date
|
||||
This type will ask the user to input a date.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "date"
|
||||
ask.en = "the date"
|
||||
ask.fr = "la date "
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "date",
|
||||
"ask": {
|
||||
"en": "the date",
|
||||
"fr": "la date"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### Time
|
||||
This type will ask the user to input a Time (hours and minutes).
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = "time"
|
||||
ask.en = "time"
|
||||
ask.fr = "l horaire"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "date",
|
||||
"ask": {
|
||||
"en": "time",
|
||||
"fr": "l horaire"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
||||
### File
|
||||
This type will ask the user to input a file.
|
||||
|
||||
[ui-tabs position="top-left" active="0" theme="lite"]
|
||||
[ui-tab title="in toml"]
|
||||
```toml
|
||||
[maybe.some.stuff.before.the_name]
|
||||
type = file""
|
||||
ask.en = "the file"
|
||||
ask.fr = "le fichier"
|
||||
```
|
||||
[/ui-tab]
|
||||
[ui-tab title="in json"]
|
||||
```javascript
|
||||
{
|
||||
"name": "the_name",
|
||||
"type": "file",
|
||||
"ask": {
|
||||
"en": "the file",
|
||||
"fr": "le fichier"
|
||||
}
|
||||
},
|
||||
```
|
||||
[/ui-tab]
|
||||
[/ui-tabs]
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
---
|
||||
title: User groups and permissions
|
||||
template: docs
|
||||
taxonomy:
|
||||
category: docs
|
||||
routes:
|
||||
default: '/packaging_apps_permissions'
|
||||
---
|
||||
|
||||
Lors de l'installation d'une nouvelle application par défaut tout les utilisateurs présent sur l'instance Yunohosti y ont accès.
|
||||
Autrement dit, la permission `app.main` et attribuer à tout les utilisateurs.
|
||||
|
||||
```shell
|
||||
ynh_permission_update --permission "main" --add visitors
|
||||
```
|
||||
|
||||
Si vous souhaitez créer une autorisation personnalisée pour votre application (par ex. pour restreindre l’accès à une interface d’administration), vous pouvez utiliser les helpers suivants :
|
||||
|
||||
```shell
|
||||
ynh_permission_create --permission "admin" --url "/admin" --allowed "$admin_user" --label "Label for your permission"
|
||||
```
|
||||
|
||||
Vous n’avez pas besoin de prendre soin de supprimer les permissions ou de les sauvegarder/restaurer puisque cela est géré par le noyau de YunoHost.
|
||||
|
||||
### Migration depuis l'ancien système de permission
|
||||
|
||||
Lors de la migration ou réparation d'une application utilisant toujours l'ancien système d'autorisation, il faut comprendre que les accès doivent désormais être gérés par les fonctionnalités du noyau, en dehors des scripts de application !
|
||||
|
||||
Les scripts de l'application doivent uniquement :
|
||||
- le cas échéant, dans le script d'installation, initialisez la permission principale de l'application comme publique (`groupe "visitors"`) ou privée (`groupe "all_users"`) ou uniquement accessible à des groupes/utilisateurs spécifiques ;
|
||||
- le cas échéant, créez et initialisez toute autre autorisation spécifique (par exemple pour une interface d'administration) dans le script d'installation (et *peut-être* dans certaines migrations se produisant dans le script de mise à niveau).
|
||||
|
||||
Les scripts d'applications ne doivent absolument ** PAS ** modifier les accès aux applications déjà existantes (y compris les paramètres « non protégés »/« skiped_uris ») dans tous les autres cas, car * cela réinitialiserait toute règle d'accès définie par l'administrateur * !
|
||||
|
||||
Lors de la migration depuis l'ancienne autorisation, vous devez :
|
||||
- supprimer toute gestion des paramètres de type `$is_public` ou `$admin_user`, à l'exception de toute question dans le manifeste destinée à *initialiser* l'application avec les autorisations publiques/privées ou spécifiques ;
|
||||
- supprimer les anciennes autorisations héritées. Découvrez comment il est recommandé de procéder dans l'application example_ynh (en particulier [cet extrait de code](https://github.com/YunoHost/example_ynh/pull/111/files#diff-57aeb84da86cb7420dfedd8e49bc644fb799d5413d01927a0417bde753e8922f))
|
||||
|
||||
|
||||
Cela devrait se résumer à :
|
||||
```bash
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
|
||||
# Create the permission using the new framework (if your app has relevant additional permissions)
|
||||
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
||||
fi
|
||||
```
|
||||
- supprimer tout appel à `yunohost app addaccess` et actions similaires sont désormais obsolètes et dépréciées.
|
||||
- si votre application utilise LDAP et prend en charge les filtres, utilisez le filtre
|
||||
`'(&(objectClass=posixAccount)(permission=cn=YOUR_APP.main,ou=permission,dc=yunohost,dc=org))'`
|
||||
pour autoriser les utilisateurs qui ont ces permissions. ( Une complete documentation du fonctionnement de LDAP est disponible [ici](https://moulinette.readthedocs.io/en/latest/ldap.html) si vous voulez comprendre comment cela fonctionne avec YunoHost.
|
||||
|
||||
#### Fonctionnalités supplémentaires de 4.1
|
||||
|
||||
- Personnalisation de l'étiquette : c'est le nom affiché aux utilisateurs finaux dans le portail utilisateur. Vous pouvez fournir une étiquette par défaut (par exemple, app.admin peut être étiqueté « interface d'administration »). L'étiquette peut être modifiée ultérieurement par l'administrateur après l'installation.
|
||||
- Activation/désactivation de la vignette : elle permet choisir si une application est affichée ou non dans le portail utilisateur (si l'utilisateur a l'autorisation correspondante). L'option correspondante s'appelle `show_tile` qui peut être `True` ou `False`. Une seule application peut avoir plusieurs vignettes dans le SSO. L'URL de chaque vignettes correspond au paramètre 'url' de l'autorisation.
|
||||
- Prise en charge d'URL multiples : une autorisation peut être associée à des URL supplémentaires. Cela donne la possibilité de protéger de nombreuses URL avec la même permission - en particulier pour les cas d'utilisation délicats (par exemple plusieurs parties de l'interface d'administration réparties sur différents sous-pages).
|
||||
- Autorisation de protection : en tant qu'empaqueteur, vous pouvez choisir de « protéger » une autorisation si vous pensez qu'il n'est pas pertinent
|
||||
pour l'administrateur d'ajouter/supprimer cette autorisation au groupe de visiteurs. C'est par exemple le cas pour l'autorisation API de Nextcloud, qui dans la grande majorité des cas devrait être conservée publiquement car le client mobile ne passera pas par le SSO. Notez que lors de l'utilisation de l'assistant `ynh_permission_update`, il est toujours possible d'ajouter/supprimer le groupe `visitor` de cette permission.
|
||||
- Désactivation de l'en-tête d'authentification : certains mécanismes d'authentification d'application n'apprécient pas que SSOwat injecte l'en-tête d'autorisation (qui est un mécanisme essentiel pour le mécanisme de connexion unique). Vous pouvez maintenant choisir de désactiver l'injection de l'en-tête d'authentification de SSOwat pour résoudre ce problème (au lieu du hack précédent consistant à utiliser `skiped_uris`)
|
||||
|
||||
|
||||
##### Correspondance entre le ancien et le nouvau système de permission
|
||||
|
||||
| | with auth header | no auth header |
|
||||
| :---------- | :--------------- | :------------- |
|
||||
| **public** | unprotected_uris | skipped_uris |
|
||||
| **private** | protected_uris | N/A |
|
||||
|
||||
|
||||
| | with auth header | no auth header |
|
||||
| :---------- | :------------------------------------------ | :------------------------------------------- |
|
||||
| **public** | auth_header=True, visitor group allowed | auth_header=False, visitor group allowed |
|
||||
| **private** | auth_header=True, visitor group not allowed | auth_header=False, visitor group not allowed |
|
||||
|
||||
|
||||
Toutes ces fonctionnalitées sont managable via les helper suivant:
|
||||
- `ynh_permission_create`
|
||||
- `ynh_permission_url`
|
||||
- `ynh_permission_update`
|
||||
|
||||
Si vous avez des question, merci de contacter l'équipe app.
|
Loading…
Add table
Reference in a new issue