From 8d868c32971042da25193ab7d49f659003d426a1 Mon Sep 17 00:00:00 2001 From: Nicolas Maillat Date: Fri, 7 Jul 2023 09:42:01 +0200 Subject: [PATCH 1/2] PHRAS-3860 Sync phraseanet root account info (#4331) * user edit command * PHRAS-3859 set defaut fastcgi-https to off * PHRAS-3859 fix typo and explain * edit lastname, firstname, company * fix * sync Phraseanet root account * Update entrypoint.sh * fix test install --------- Co-authored-by: aynsix Co-authored-by: Moctar --- docker-compose.yml | 48 -------------------- docker/nginx/root/entrypoint.sh | 5 +- docker/phraseanet/setup/entrypoint.sh | 6 +-- docker/phraseanet/setup/init-test-install.sh | 30 ++++-------- 4 files changed, 15 insertions(+), 74 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e98a531dbc..1f00de2ab7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -207,9 +207,6 @@ services: restart: on-failure environment: - STACK_NAME - - PHRASEANET_INSTALL - - PHRASEANET_SETUP - - PHRASEANET_UPGRADE - PHRASEANET_PROJECT_NAME - PHRASEANET_TRUSTED_PROXIES - PHRASEANET_DEBUG_ALLOWED_IP @@ -222,37 +219,9 @@ services: - OPCACHE_ENABLED - SESSION_CACHE_LIMITER - PHP_LOG_LEVEL - - PHRASEANET_ADMIN_ACCOUNT_ID - - PHRASEANET_ADMIN_ACCOUNT_EMAIL - - PHRASEANET_ADMIN_ACCOUNT_PASSWORD - - PHRASEANET_DB_HOST - - PHRASEANET_DB_PORT - - PHRASEANET_DB_USER - - PHRASEANET_DB_PASSWORD - - INSTALL_DB_TEMPLATE - - INSTALL_APPBOX - - INSTALL_DATABOX - PHRASEANET_SCHEME - PHRASEANET_HOSTNAME - PHRASEANET_APP_PORT - - PHRASEANET_AVAILABLE_LANGUAGE - - PHRASEANET_DEFAULT_LANGUAGE - - PHRASEANET_RABBITMQ_HOST - - PHRASEANET_RABBITMQ_PORT - - PHRASEANET_RABBITMQ_SSL - - PHRASEANET_RABBITMQ_VHOST - - PHRASEANET_RABBITMQ_HEARTBEAT - - PHRASEANET_RABBITMQ_USER=$RABBITMQ_DEFAULT_USER - - PHRASEANET_RABBITMQ_PASSWORD=$RABBITMQ_DEFAULT_PASS - - PHRASEANET_EMITTER_EMAIL - - PHRASEANET_MAIL_OBJECT_PREFIX - - PHRASEANET_SMTP_ENABLED - - PHRASEANET_SMTP_HOST - - PHRASEANET_SMTP_PORT - - PHRASEANET_SMTP_AUTH_ENABLED - - PHRASEANET_SMTP_SECURE_MODE - - PHRASEANET_SMTP_USER - - PHRASEANET_SMTP_PASSWORD - PHRASEANET_DOWNLOAD_DIR - PHRASEANET_LAZARET_DIR - PHRASEANET_CAPTION_DIR @@ -284,23 +253,6 @@ services: - BLACKFIRE_SERVER_TOKEN - SESSION_SAVE_HANDLER - SESSION_SAVE_PATH - - PHRASEANET_CACHE_TYPE - - PHRASEANET_CACHE_HOST - - PHRASEANET_CACHE_PORT - - PHRASEANET_ELASTICSEARCH_HOST - - PHRASEANET_ELASTICSEARCH_PORT - - PHRASEANET_ELASTICSEARCH_INDEX - - PHRASEANET_ELASTICSEARCH_SHARD - - PHRASEANET_ELASTICSEARCH_REPLICAS - - PHRASEANET_ELASTICSEARCH_MINSCORE - - PHRASEANET_ELASTICSEARCH_HIGHLIGHT - - PHRASEANET_ELASTICSEARCH_MAXRESULTWINDOW - - PHRASEANET_ELASTICSEARCH_POPULATEORDER - - PHRASEANET_ELASTICSEARCH_ACTIVETAB - - PHRASEANET_ELASTICSEARCH_FACET_BASE - - PHRASEANET_ELASTICSEARCH_FACET_COLLECTION - - PHRASEANET_ELASTICSEARCH_FACET_DOCTYPE - - PHRASEANET_ELASTICSEARCH_FACET_ORIENTATION - PHRASEANET_MAINTENANCE volumes: diff --git a/docker/nginx/root/entrypoint.sh b/docker/nginx/root/entrypoint.sh index cfb87b5f6a..313744a81b 100755 --- a/docker/nginx/root/entrypoint.sh +++ b/docker/nginx/root/entrypoint.sh @@ -68,6 +68,7 @@ if [[ ! -z $GATEWAY_ALLOWED_IPS ]] || [[ ! -z $GATEWAY_DENIED_IPS ]] || [[ ! -z echo "deny all;" >> /etc/nginx/restrictions fi fi - - +unset GATEWAY_USERS +unset GATEWAY_DENIED_IPS +unset GATEWAY_ALLOWED_IPS exec "$@" diff --git a/docker/phraseanet/setup/entrypoint.sh b/docker/phraseanet/setup/entrypoint.sh index 0baf7bafc0..23c8453fbf 100755 --- a/docker/phraseanet/setup/entrypoint.sh +++ b/docker/phraseanet/setup/entrypoint.sh @@ -193,9 +193,10 @@ if [[ -f "$FILE" && $PHRASEANET_SETUP = 1 ]]; then bin/setup system:config set -q registry.email.prefix "$PHRASEANET_MAIL_OBJECT_PREFIX" fi - echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet root account Password sync" + echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet Root account sync" if [[ -n ${PHRASEANET_ADMIN_ACCOUNT_ID} && $PHRASEANET_ADMIN_ACCOUNT_ID =~ ^[0-9]+$ ]]; then - bin/console user:password --user_id=$PHRASEANET_ADMIN_ACCOUNT_ID --password $PHRASEANET_ADMIN_ACCOUNT_PASSWORD -y + bin/console user:edit --user_id=$PHRASEANET_ADMIN_ACCOUNT_ID --login $PHRASEANET_ADMIN_ACCOUNT_EMAIL --email $PHRASEANET_ADMIN_ACCOUNT_EMAIL --password $PHRASEANET_ADMIN_ACCOUNT_PASSWORD -y + echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet Root account synced" fi echo `date +"%Y-%m-%d %H:%M:%S"` " - config/configuration.yml update by Phraseanet entrypoint.sh Finished !" @@ -234,7 +235,6 @@ chown -R app:app www echo `date +"%Y-%m-%d %H:%M:%S"` " - End of chown!" - echo `date +"%Y-%m-%d %H:%M:%S"` " - End of Phraseanet setup entrypoint.sh" if [[ $PHRASEANET_MAINTENANCE = 2 ]];then diff --git a/docker/phraseanet/setup/init-test-install.sh b/docker/phraseanet/setup/init-test-install.sh index 5f96ebc58c..3bb0696794 100755 --- a/docker/phraseanet/setup/init-test-install.sh +++ b/docker/phraseanet/setup/init-test-install.sh @@ -8,33 +8,21 @@ php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer composer install --ignore-platform-reqs --no-interaction - - -if [ -z "$PHRASEANET_ADMIN_ACCOUNT_EMAIL" ]; then - echo "PHRASEANET_ADMIN_ACCOUNT_EMAIL, Phraseanet admin account var is not set." - exit 1 -fi - -if [ -z "$PHRASEANET_ADMIN_ACCOUNT_PASSWORD " ]; then - echo "$PHRASEANET_ADMIN_ACCOUNT_PASSWORD, Phaseanet admin password var is not set." - exit 1 -fi - FILE=config/configuration.yml while [[ ! -e "$FILE" ]] do sleep 10 /var/alchemy/Phraseanet/bin/setup system:install \ - --email=$PHRASEANET_ADMIN_ACCOUNT_EMAIL \ - --password=$PHRASEANET_ADMIN_ACCOUNT_PASSWORD \ - --db-host=$PHRASEANET_DB_HOST \ - --db-port=$PHRASEANET_DB_PORT \ - --db-user=$PHRASEANET_DB_USER \ - --db-password=$PHRASEANET_DB_PASSWORD \ - --db-template=$INSTALL_DB_TEMPLATE \ - --appbox=$INSTALL_APPBOX \ - --databox=$INSTALL_DATABOX \ + --email=test@test.fr \ + --password=test \ + --db-host=db \ + --db-port=3306 \ + --db-user=root \ + --db-password=root \ + --db-template=DublinCore \ + --appbox=ab_master \ + --databox=db_databox1 \ --server-name=$PHRASEANET_BASE_URL \ --download-path=$PHRASEANET_DOWNLOAD_DIR \ --lazaret-path=$PHRASEANET_LAZARET_DIR \ From 690a5d2dce0e31acb1673818e920088a43253c4f Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:55:21 +0300 Subject: [PATCH 2/2] fix prod editing with no right (#4332) --- Phraseanet-production-client/dist/production.js | 8 ++++++++ Phraseanet-production-client/dist/production.min.js | 8 ++++++++ .../src/components/record/edit.js | 8 ++++++++ templates/web/prod/actions/edit_default.html.twig | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Phraseanet-production-client/dist/production.js b/Phraseanet-production-client/dist/production.js index 72e09dfc69..82e7453130 100644 --- a/Phraseanet-production-client/dist/production.js +++ b/Phraseanet-production-client/dist/production.js @@ -5521,6 +5521,14 @@ var editRecord = function editRecord(services) { success: function success(data) { (0, _jquery2.default)('#EDITWINDOW').removeClass('loading').empty().html(data); + // if the user have not "edit" right in all selected document + if (window.recordEditorConfig.state.T_records.length === 0) { + alert(window.recordEditorConfig.notActionableMsg); + (0, _jquery2.default)('#EDITWINDOW').removeClass('loading').hide(); + + return; + } + if (window.recordEditorConfig.hasMultipleDatabases === true) { (0, _jquery2.default)('#EDITWINDOW').removeClass('loading').hide(); diff --git a/Phraseanet-production-client/dist/production.min.js b/Phraseanet-production-client/dist/production.min.js index 72e09dfc69..82e7453130 100644 --- a/Phraseanet-production-client/dist/production.min.js +++ b/Phraseanet-production-client/dist/production.min.js @@ -5521,6 +5521,14 @@ var editRecord = function editRecord(services) { success: function success(data) { (0, _jquery2.default)('#EDITWINDOW').removeClass('loading').empty().html(data); + // if the user have not "edit" right in all selected document + if (window.recordEditorConfig.state.T_records.length === 0) { + alert(window.recordEditorConfig.notActionableMsg); + (0, _jquery2.default)('#EDITWINDOW').removeClass('loading').hide(); + + return; + } + if (window.recordEditorConfig.hasMultipleDatabases === true) { (0, _jquery2.default)('#EDITWINDOW').removeClass('loading').hide(); diff --git a/Phraseanet-production-client/src/components/record/edit.js b/Phraseanet-production-client/src/components/record/edit.js index 2257cc76eb..5cbc15756c 100644 --- a/Phraseanet-production-client/src/components/record/edit.js +++ b/Phraseanet-production-client/src/components/record/edit.js @@ -52,6 +52,14 @@ const editRecord = (services) => { success: (data) => { $('#EDITWINDOW').removeClass('loading').empty().html(data); + // if the user have not "edit" right in all selected document + if (window.recordEditorConfig.state.T_records.length === 0) { + alert(window.recordEditorConfig.notActionableMsg); + $('#EDITWINDOW').removeClass('loading').hide(); + + return; + } + if (window.recordEditorConfig.hasMultipleDatabases === true) { $('#EDITWINDOW').removeClass('loading').hide(); diff --git a/templates/web/prod/actions/edit_default.html.twig b/templates/web/prod/actions/edit_default.html.twig index 16b0eab60e..75ad023773 100644 --- a/templates/web/prod/actions/edit_default.html.twig +++ b/templates/web/prod/actions/edit_default.html.twig @@ -453,7 +453,7 @@ var recordEditorConfig = { hasMultipleDatabases: {% if multipleDataboxes or recordsRequest|length == 0 %}true{% else %}false{% endif %}, - databoxId: {% if multipleDataboxes %}0{% else %}{{ databox.get_sbas_id }}{% endif %}, + databoxId: {% if multipleDataboxes or multipleDataboxes is empty %}0{% else %}{{ databox.get_sbas_id }}{% endif %}, mode: {% if recordsRequest.isSingleStory() %}'GRP'{% else %}'LST'{% endif %}, notActionable: {{ not_actionable }}, notActionableMsg: '{{notActionableMsg}}',