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

Merge pull request #96 from YunoHost-Apps/configure-team

Create first user and team from the app install
This commit is contained in:
Pierre de La Morinerie 2018-02-16 19:27:00 +05:30 committed by GitHub
commit 8781185d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 3 deletions

View file

@ -2,10 +2,12 @@
; Manifest
domain="ynhtests.local" (DOMAIN)
path="" (PATH)
user="admin" (USER)
language="fr"
admin_email="john@gmail.com"
admin_password="mattermost_password"
admin_locale="fr"
team_display_name="Mon équipe"
is_public=1 (PUBLIC|public=1|private=0)
password="alpine"
analytics=0
; Checks
pkg_linter=1
setup_root=1

View file

@ -40,6 +40,42 @@
},
"default": true
},
{
"name": "admin_email",
"ask": {
"en": "Login email for the chat admin",
"fr": "Adresse email de login pour ladministrateur du chat"
},
"example": "john@gmail.com",
"optional": false
},
{
"name": "admin_password",
"type": "password",
"ask": {
"en": "Password for the chat admin",
"fr": "Mot de passe pour ladministrateur du chat"
},
"optional": false
},
{
"name": "admin_locale",
"ask": {
"en": "Choose the language of the chat for the admin",
"fr": "Choissisez la langue utilisée pour l'administrateur"
},
"choices": ["en", "fr"],
"default": "en"
},
{
"name": "team_display_name",
"ask": {
"en": "Choose a Team name",
"fr": "Choisissez le nom de léquipe"
},
"example": "Super Groupe",
"optional": false
},
{
"name": "analytics",
"type": "boolean",

View file

@ -23,6 +23,10 @@ ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME
domain=$YNH_APP_ARG_DOMAIN
is_public=$YNH_APP_ARG_IS_PUBLIC
admin_email=$YNH_APP_ARG_ADMIN_EMAIL
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
admin_locale=$YNH_APP_ARG_ADMIN_LOCALE
team_display_name=$YNH_APP_ARG_TEAM_DISPLAY_NAME
analytics=$YNH_APP_ARG_ANALYTICS
path_url="/"
@ -194,3 +198,20 @@ sudo systemctl reload nginx
#=================================================
sudo systemctl start "$app"
#=================================================
# CREATE ADMIN AND FIRST TEAM
#=================================================
admin_username=$(cut -d @ -f 1 <<< "$admin_email")
team_name=$(echo "$team_display_name" | iconv -f utf8 -t ascii//TRANSLIT//IGNORE | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z)
cd "$final_path/bin"
sudo ./platform user create --username "$admin_username" --email "$admin_email" --password "$admin_password" --locale "$admin_locale" --system_admin
sudo ./platform user verify "$admin_username"
sudo ./platform team create --name "$team_name" --display_name "$team_display_name" --email "$admin_email"
sudo ./platform team add "$team_name" "$admin_username"
ynh_app_setting_set "$app" admin_email "$admin_email"
ynh_app_setting_set "$app" admin_locale "$admin_locale"
ynh_app_setting_set "$app" team_name "$team_name"