mirror of
https://github.com/YunoHost-Apps/dato_ynh.git
synced 2024-09-03 18:16:33 +02:00
Resolved couchdb change that users could not consult their profile and therefore login to dato.
This commit is contained in:
parent
66be001f21
commit
1f2e3a679e
3 changed files with 22 additions and 5 deletions
|
@ -7,3 +7,6 @@ credentials = true
|
|||
headers = accept, authorization, content-type, origin, referer
|
||||
methods = GET, PUT, POST, HEAD, DELETE
|
||||
origins = https://__DOMAIN__
|
||||
|
||||
[couchdb]
|
||||
users_db_security_editable = true
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="curl"
|
||||
pkg_dependencies="curl jq"
|
||||
|
||||
# nodejs version
|
||||
nodejs_version=12
|
||||
|
|
|
@ -174,20 +174,34 @@ if [[ $autosynchronize == true ]]; then
|
|||
couch_pw_url=$(echo "$couch_url" | sed -En "s+^https?://+https://$couch_admin_name:$couch_admin_password@+p")
|
||||
|
||||
# add admin user to couch users database
|
||||
curlResult=$(curl -X PUT "$couch_pw_url/_users/org.couchdb.user:$couch_datoadmin_name" \
|
||||
addDatoAdmin_curlResult=$(curl -X PUT "$couch_pw_url/_users/org.couchdb.user:$couch_datoadmin_name" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"name\": \"$couch_datoadmin_name\", \"password\": \"$couch_datoadmin_password\", \"roles\": [\"dato-admin\"], \"type\": \"user\"}" 2> /dev/null)
|
||||
|
||||
# display error message if there was an error creating dato admin user in couch
|
||||
if [[ $curlResult != '{"ok":true,'* ]]; then
|
||||
if [[ $addDatoAdmin_curlResult != '{"ok":true,'* ]]; then
|
||||
ynh_print_err --message="There was an error creating the dato admin user for in couch. You will probably have to do it manually (check the last section of this page for instructions: https://squeak.eauchat.org/apps/dato/?setups)."
|
||||
ynh_print_err --message="Here is the error message from couchdb:"
|
||||
ynh_print_err --message="$curlResult"
|
||||
ynh_print_err --message="$addDatoAdmin_curlResult"
|
||||
ynh_print_err --message="Please make sure that your couchdb instance is accessible from the url you provided, with a proper SSL certificate (not a self-signed one), otherwise you will not be able to login to dato!"
|
||||
ynh_print_err --message="$curlResult"
|
||||
fi
|
||||
|
||||
# modify _users db _security document
|
||||
usersSecDoc=$(curl -X GET "$couch_pw_url/_users/_security")
|
||||
usersSecDocModified=$(echo $usersSecDoc | jq '.members.roles += ["dato", "dato-admin"]')
|
||||
usersSecDocChange_curlResult=$(curl -X PUT "$couch_pw_url/_users/_security" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$usersSecDocModified" 2> /dev/null)
|
||||
|
||||
# display error message if there was an error modifying _users db _security document
|
||||
if [[ $usersSecDocChange_curlResult != '{"ok":true,'* ]]; then
|
||||
ynh_print_err --message="There was an error enabling dato users to access their user profile in couch. You will have to do it manually (check the 'Configure couchdb so that it accepts requests from dato' section in the following page for instructions: https://squeak.eauchat.org/apps/dato/?setups)."
|
||||
ynh_print_err --message="Here is the error message from couchdb:"
|
||||
ynh_print_err --message="$usersSecDocChange_curlResult"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue