mirror of
https://github.com/YunoHost-Apps/diaspora_ynh.git
synced 2024-09-03 18:26:13 +02:00
Add admin creation
This commit is contained in:
parent
012e3162d9
commit
fd153f4f76
2 changed files with 29 additions and 2 deletions
|
@ -60,6 +60,15 @@
|
||||||
"fr": "Choisissez l'administrateur de diaspora* (doit être un utilisateur YunoHost)"
|
"fr": "Choisissez l'administrateur de diaspora* (doit être un utilisateur YunoHost)"
|
||||||
},
|
},
|
||||||
"example": "johndoe"
|
"example": "johndoe"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin_password",
|
||||||
|
"type": "password",
|
||||||
|
"ask": {
|
||||||
|
"en": "Admin password. Must contain at least 10 characters, one lowercase letter, one uppercase letter, one number, and one symbol (e.g. '~!@#$%^&*()').",
|
||||||
|
"fr": "Mot de passe pour l’administrateur. Doit contenir au moins 10 caractères, une majuscule, une minuscule, un chiffre, et une ponctuation (ex. '~!@#$%^&*()')."
|
||||||
|
},
|
||||||
|
"optional": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
# - check logrotate
|
|
||||||
# - which service to register to ynuhosto? diaspora.target only ? All of them ?
|
# - which service to register to ynuhosto? diaspora.target only ? All of them ?
|
||||||
# - backup / restore
|
# - backup / restore
|
||||||
# - changeurl ? Is that possible ? or even a good idea ?
|
# - changeurl ? Is that possible ? or even a good idea ?
|
||||||
# - make an admin automatically
|
# - make an admin automatically
|
||||||
# - integration with ssowat? Or not?
|
# - integration with ssowat? Or not? How exactly?
|
||||||
|
# - a setting to enable / disable registration
|
||||||
|
# - say something about the registration to https://the-federation.info/
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
|
@ -32,6 +33,7 @@ domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
|
||||||
admin_email=$(ynh_user_get_info --username=$admin --key=mail)
|
admin_email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,3 +236,19 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload nginx..." --time --weight=1
|
ynh_script_progression --message="Reload nginx..." --time --weight=1
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE AN ADMIN
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Create admin..." --time --weight=1
|
||||||
|
pushd $final_path/diaspora
|
||||||
|
sudo -u diaspora /bin/bash --login << EOF
|
||||||
|
RAILS_ENV=production bundle exec rails console << END
|
||||||
|
user = User.build({username: '$admin', email: '$admin_email', password: '$admin_password', password_confirmation: '$admin_password' })
|
||||||
|
user.seed_aspects
|
||||||
|
user.save
|
||||||
|
Role.add_admin user.person
|
||||||
|
END
|
||||||
|
EOF
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue