admin avatar added

nc-nginx-test
elena 2023-02-22 14:41:44 +00:00 committed by Evilham
parent 358004899b
commit 92c5828b33
2 changed files with 9 additions and 5 deletions

9
dd-ctl
View File

@ -327,6 +327,7 @@ down(){
setup_nextcloud(){ setup_nextcloud(){
echo " --> Applying custom settings in nextcloud" echo " --> Applying custom settings in nextcloud"
cp "$CUSTOM_PATH/custom/avatars/dd" "$DATA_FOLDER/avatars/master-avatars/"
# docker exec -u www-data dd-apps-nextcloud-app sh -c 'export OC_PASS=$DDADMIN_PASSWORD && php occ user:add --password-from-env --display-name="DD Admin" --group="admin" $DDADMIN_USER' # docker exec -u www-data dd-apps-nextcloud-app sh -c 'export OC_PASS=$DDADMIN_PASSWORD && php occ user:add --password-from-env --display-name="DD Admin" --group="admin" $DDADMIN_USER'
# docker exec -u www-data dd-apps-nextcloud-app sh -c 'export OC_PASS=admin && php occ user:delete admin' # docker exec -u www-data dd-apps-nextcloud-app sh -c 'export OC_PASS=admin && php occ user:delete admin'
@ -996,11 +997,11 @@ case "$OPERATION" in
update_logos_and_menu update_logos_and_menu
;; ;;
customize) customize)
up #up
wait_for_moodle #wait_for_moodle
setup_nextcloud setup_nextcloud
setup_wordpress #setup_wordpress
setup_moodle #setup_moodle
;; ;;
down) down)
down down

View File

@ -49,8 +49,11 @@ def setup_avatar_views(app: "ApiFlaskApp") -> None:
# TODO: check if this is redundant and remove it # TODO: check if this is redundant and remove it
@app.route("/avatar/<username>", methods=["GET"]) @app.route("/avatar/<username>", methods=["GET"])
def avatar(username: str) -> Response: def avatar(username: str) -> Response:
file = 'dd'
if username != 'admin':
file = avatars.get_user_avatar(username)
return send_from_directory( return send_from_directory(
os.path.join(app.root_path, "../avatars/master-avatars/"), os.path.join(app.root_path, "../avatars/master-avatars/"),
avatars.get_user_avatar(username), file,
mimetype="image/jpg", mimetype="image/jpg",
) )