|
|
@ -697,8 +697,9 @@ export -f compose:container:service |
|
|
|
|
|
|
|
compose:psql() { |
|
|
|
local project_name="$1" dbname="$2" container_id |
|
|
|
shift 2 |
|
|
|
container_id=$(compose:charm:container_one "$project_name" "postgres") || return 1 |
|
|
|
docker exec -i "${container_id}" psql -U postgres "$dbname" |
|
|
|
docker exec -i "${container_id}" psql -U postgres "$dbname" "$@" |
|
|
|
} |
|
|
|
export -f compose:psql |
|
|
|
|
|
|
@ -767,6 +768,13 @@ postgres:restore() { |
|
|
|
export -f postgres:restore |
|
|
|
|
|
|
|
|
|
|
|
odoo:get_public_user_id() { |
|
|
|
local project_name="$1" dbname="$2" |
|
|
|
echo "select res_id from ir_model_data where model = 'res.users' and name = 'public_user';" | |
|
|
|
compose:psql "$project_name" "$dbname" -qAt |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cyclos:set_root_url() { |
|
|
|
local project_name="$1" dbname="$2" url="$3" |
|
|
|
|
|
|
@ -1387,6 +1395,26 @@ cmdline.spec:odoo:cmd:set-cyclos-url:run() { |
|
|
|
} |
|
|
|
EOF |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cmdline.spec.gnu fix-sso |
|
|
|
cmdline.spec:odoo:cmd:fix-sso:run() { |
|
|
|
|
|
|
|
: :optval: --database,-d "Target database ('odoo' if not specified)" |
|
|
|
|
|
|
|
local public_user_id project_name dbname |
|
|
|
|
|
|
|
dbname=${opt_database:-odoo} |
|
|
|
project_name=$(compose:project_name) || exit 1 |
|
|
|
public_user_id=$(odoo:get_public_user_id "${project_name}" "${dbname}") || exit 1 |
|
|
|
Wrap -d "fix website's object to 'public_user' (id=$public_user_id)" <<EOF || exit 1 |
|
|
|
echo "UPDATE website SET user_id = $public_user_id;" | |
|
|
|
compose:psql "$project_name" "$dbname" || { |
|
|
|
err "Failed to set website's object user_id to public user's id ($public_user_id) in '$dbname' database." |
|
|
|
exit 1 |
|
|
|
} |
|
|
|
EOF |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|