diff --git a/.github/workflows/pipeline-development.yml b/.github/workflows/pipeline-development.yml new file mode 100644 index 00000000..bef4b651 --- /dev/null +++ b/.github/workflows/pipeline-development.yml @@ -0,0 +1,9 @@ +name: Run Development Build and Tests +env: + GITHUB_TOKEN: ${{ secrets.token }} + +on: push + +jobs: + artifact: + uses: h2-invent/open-datenschutzcenter/.github/workflows/task-artifact.yml@master diff --git a/.github/workflows/pipeline-release.yml b/.github/workflows/pipeline-release.yml new file mode 100644 index 00000000..050ceabf --- /dev/null +++ b/.github/workflows/pipeline-release.yml @@ -0,0 +1,67 @@ +name: Create Release +env: + GITHUB_TOKEN: ${{ secrets.token }} + +on: + push: + branches: + - main + - master + +jobs: + artifact: + uses: h2-invent/open-datenschutzcenter/.github/workflows/task-artifact.yml@master + + create_release: + needs: + - artifact + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: paulhatch/semantic-version@v5.0.2 + id: version + with: + tag_prefix: "" + major_pattern: "(MAJOR)" + minor_pattern: "(MINOR)" + change_path: . + version_format: "${major}.${minor}.${patch}" + + - uses: actions/download-artifact@v3 + with: + name: artifact_${{github.run_number}} + + - run: unzip -qq artifact_${{github.run_number}}.zip -d artifact + + - name: Write semantic Version in .env.local + uses: jacobtomlinson/gha-find-replace@v3 + with: + find: "laF_version=2.0.0-dev" + replace: "laF_version=${{ steps.version.outputs.version }}" + regex: false + include: "artifact/.env" + + - name: Archive Release for application + uses: thedoctor0/zip-release@0.7.1 + with: + type: 'zip' + filename: 'application.zip' + exclusions: '*.git* *.github* /*node_modules/* /*nodejs/* /*var/* .editorconfig' + directory: artifact + + - name: Create new Release with semantic-version tag + uses: ncipollo/release-action@v1 + id: create_release + with: + draft: true + prerelease: false + name: Release ${{ steps.version.outputs.version }} + tag: ${{ steps.version.outputs.version }} + artifacts: artifact/application.zip + artifactContentType: application/zip + bodyFile: RELEASE_NOTE.md diff --git a/.github/workflows/task-artifact.yml b/.github/workflows/task-artifact.yml new file mode 100644 index 00000000..753f6cf7 --- /dev/null +++ b/.github/workflows/task-artifact.yml @@ -0,0 +1,33 @@ +name: Build Artifacts + +on: workflow_call + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install PHP Dependencies + uses: php-actions/composer@v6 + with: + php_version: ${{ vars.PHP_VERSION }} + php_extensions: ldap xsl zip + + - name: Install NPM Packages + uses: actions/setup-node@v3 + with: + node-version: ${{ vars.NODE_VERSION }} + - run: npm install + - run: npm run build + - run: rm -r node_modules + + - uses: montudor/action-zip@v1 + with: + args: zip -qq -r artifact_${{github.run_number}}.zip . + + - name: Upload articats + uses: actions/upload-artifact@v3 + with: + name: artifact_${{github.run_number}} + path: artifact_${{github.run_number}}.zip diff --git a/RELEASE_NOTE.md b/RELEASE_NOTE.md new file mode 100644 index 00000000..fb5c1c3b --- /dev/null +++ b/RELEASE_NOTE.md @@ -0,0 +1,3 @@ +# RELEASE NOTE + +* Fix Downlaod of Documents diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 7d1c289f..2a70ddb5 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -14,7 +14,7 @@ x-app-common: &odc_app services: traefik-odc: image: "traefik:v2.5" - + restart: unless-stopped command: #- "--log.level=DEBUG" - "--api.insecure=true" @@ -59,7 +59,7 @@ services: timeout: 10s start_period: 30s retries: 10 - + restart: unless-stopped environment: APP_ENV: "dev" APACHE_DOCUMENT_ROOT: "public/" @@ -81,6 +81,7 @@ services: MAILER_ENCRYPTION: ${MAILER_ENC} laF_version: ${GIT_VERSION} registerEmailAdress: ${registerEmailAdress} + DEFAULT_EMAIL: ${registerEmailAdress} laF_baseUrl: ${HTTP_METHOD}://${PUBLIC_URL} VICH_BASE: ${HTTP_METHOD}://${PUBLIC_URL} CRON_USER_1: root @@ -106,6 +107,7 @@ services: db-odc: image: mariadb:latest hostname: ${RANDOMTAG}db-odc + restart: unless-stopped healthcheck: test: [ "CMD", "mariadb-admin" ,"ping", "-h", "localhost","-ptest" ] timeout: 20s @@ -120,6 +122,7 @@ services: keycloak-odc: image: quay.io/keycloak/keycloak:22.0.3 + restart: unless-stopped depends_on: app-odc: condition: service_healthy diff --git a/docker-compose.yml b/docker-compose.yml index 32fdadbf..98a5e7e8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -70,6 +70,7 @@ services: timeout: 10s start_period: 30s retries: 10 + restart: unless-stopped environment: APACHE_DOCUMENT_ROOT: "public/" @@ -91,6 +92,7 @@ services: MAILER_ENCRYPTION: ${MAILER_ENC} laF_version: ${GIT_VERSION} registerEmailAdress: ${registerEmailAdress} + DEFAULT_EMAIL: ${registerEmailAdress} laF_baseUrl: ${HTTP_METHOD}://${PUBLIC_URL} VICH_BASE: ${HTTP_METHOD}://${PUBLIC_URL} CRON_USER_1: docker @@ -121,6 +123,7 @@ services: test: [ "CMD", "mariadb-admin" ,"ping", "-h", "localhost","-ptest" ] timeout: 20s retries: 10 + restart: unless-stopped environment: MARIADB_ROOT_PASSWORD: test volumes: diff --git a/installDockerDebian.sh b/installDockerDebian.sh index 55a8f3b2..cafba74b 100755 --- a/installDockerDebian.sh +++ b/installDockerDebian.sh @@ -18,7 +18,7 @@ echo \ sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin -y -sudo wget https://github.com/docker/compose/releases/download/v2.7.0/docker-compose-linux-x86_64 -O /usr/local/bin/docker-compose +sudo wget https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-linux-x86_64 -O /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose -v diff --git a/installDockerUbuntu.sh b/installDockerUbuntu.sh index b9c838bd..0a35ba90 100755 --- a/installDockerUbuntu.sh +++ b/installDockerUbuntu.sh @@ -17,7 +17,7 @@ echo \ sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin -sudo wget https://github.com/docker/compose/releases/download/v2.7.0/docker-compose-linux-x86_64 -O /usr/local/bin/docker-compose +sudo wget https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-linux-x86_64 -O /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose -v diff --git a/src/Controller/DatenweitergabeController.php b/src/Controller/DatenweitergabeController.php index 2d87fd74..6fa2b66a 100644 --- a/src/Controller/DatenweitergabeController.php +++ b/src/Controller/DatenweitergabeController.php @@ -24,6 +24,7 @@ use Symfony\Component\HttpFoundation\HeaderUtils; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -216,7 +217,14 @@ public function downloadArticleReference( return $this->redirectToRoute('dashboard'); } - $type = $datenFilesystem->getMimetype($datenweitergabe->getUpload()); + $type = null; + try { + $type = $datenFilesystem->mimeType($datenweitergabe->getUpload()); + }catch (\Exception $exception){ + throw new NotFoundHttpException('File not found'); + } + + $response = new Response($stream); $response->headers->set('Content-Type', $type); $disposition = HeaderUtils::makeDisposition( diff --git a/src/Controller/FormsController.php b/src/Controller/FormsController.php index f9b9d8c1..c3453a96 100644 --- a/src/Controller/FormsController.php +++ b/src/Controller/FormsController.php @@ -142,7 +142,7 @@ public function downloadArticleReference( return $this->redirectToRoute('dashboard'); } - $type = $formsFilesystem->getMimetype($forms->getUpload()); + $type = $formsFilesystem->mimeType($forms->getUpload()); $response = new Response($stream); $response->headers->set('Content-Type', $type); $disposition = HeaderUtils::makeDisposition( diff --git a/src/Controller/PoliciesController.php b/src/Controller/PoliciesController.php index ef4edc23..d1a926fe 100644 --- a/src/Controller/PoliciesController.php +++ b/src/Controller/PoliciesController.php @@ -144,7 +144,7 @@ public function downloadArticleReference( return $this->redirectToRoute('dashboard'); } - $type = $policiesFilesystem->getMimetype($policies->getUpload()); + $type = $policiesFilesystem->mimeType($policies->getUpload()); $response = new Response($stream); $response->headers->set('Content-Type', $type); $disposition = HeaderUtils::makeDisposition( diff --git a/src/Migrations/Version20241008090501.php b/src/Migrations/Version20241008090501.php new file mode 100644 index 00000000..427872c6 --- /dev/null +++ b/src/Migrations/Version20241008090501.php @@ -0,0 +1,75 @@ +addSql('ALTER TABLE answer CHANGE question_id question_id INT NOT NULL'); + $this->addSql('ALTER TABLE participation CHANGE akademie_buchungen_id akademie_buchungen_id INT DEFAULT NULL, CHANGE passed passed TINYINT(1) NOT NULL, CHANGE state state VARCHAR(255) NOT NULL'); + $this->addSql('ALTER TABLE participation_answer CHANGE participation_id participation_id INT NOT NULL, CHANGE questionnaire_id questionnaire_id INT NOT NULL, CHANGE question_id question_id INT NOT NULL, CHANGE answer_id answer_id INT NOT NULL'); + $this->addSql('ALTER TABLE question CHANGE eval_value eval_value DOUBLE PRECISION NOT NULL'); + $this->addSql('ALTER TABLE questionnaire CHANGE description description TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE team RENAME INDEX unq_team_name TO UNIQ_C4E0A61F5E237E06'); + $this->addSql('ALTER TABLE team_admin MODIFY id INT NOT NULL'); + foreach ($schema->getTable('team_admin')->getForeignKeys() as $foreignKey) { + $this->addSql('ALTER TABLE team_admin DROP FOREIGN KEY ' . $foreignKey->getName()); + } + $this->addSql('DROP INDEX team_admin_IdX ON team_admin'); + $this->addSql('DROP INDEX `primary` ON team_admin'); + $this->addSql('ALTER TABLE team_admin DROP id'); + $this->addSql('ALTER TABLE team_admin ADD CONSTRAINT FK_4F084436296CD8AE FOREIGN KEY (team_id) REFERENCES team (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE team_admin ADD CONSTRAINT FK_4F084436A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE team_admin ADD PRIMARY KEY (team_id, user_id)'); + $this->addSql('ALTER TABLE user RENAME INDEX idx_957a64799e73ac3e TO IDX_8D93D6499E73AC3E'); + $this->addSql('ALTER TABLE user_team MODIFY id INT NOT NULL'); + foreach ($schema->getTable('user_team')->getForeignKeys() as $foreignKey) { + $this->addSql('ALTER TABLE user_team DROP FOREIGN KEY ' . $foreignKey->getName()); + } + $this->addSql('DROP INDEX user_team_IdX ON user_team'); + $this->addSql('DROP INDEX `primary` ON user_team'); + $this->addSql('ALTER TABLE user_team DROP id'); + $this->addSql('ALTER TABLE user_team ADD CONSTRAINT FK_BE61EAD6A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE user_team ADD CONSTRAINT FK_BE61EAD6296CD8AE FOREIGN KEY (team_id) REFERENCES team (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE user_team ADD PRIMARY KEY (user_id, team_id)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE answer CHANGE question_id question_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE participation CHANGE akademie_buchungen_id akademie_buchungen_id INT NOT NULL, CHANGE state state VARCHAR(255) DEFAULT \'assigned\' NOT NULL, CHANGE passed passed TINYINT(1) DEFAULT NULL'); + $this->addSql('ALTER TABLE participation_answer CHANGE participation_id participation_id INT DEFAULT NULL, CHANGE questionnaire_id questionnaire_id INT DEFAULT NULL, CHANGE question_id question_id INT DEFAULT NULL, CHANGE answer_id answer_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE question CHANGE eval_value eval_value DOUBLE PRECISION DEFAULT \'1\' NOT NULL'); + $this->addSql('ALTER TABLE questionnaire CHANGE description description VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE team RENAME INDEX uniq_c4e0a61f5e237e06 TO UNQ_team_name'); + $this->addSql('ALTER TABLE team_admin DROP FOREIGN KEY FK_4F084436296CD8AE'); + $this->addSql('ALTER TABLE team_admin DROP FOREIGN KEY FK_4F084436A76ED395'); + $this->addSql('ALTER TABLE team_admin ADD id INT AUTO_INCREMENT NOT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (id)'); + $this->addSql('ALTER TABLE team_admin ADD CONSTRAINT RFX_team_id_team_admin_6704f59cda29d FOREIGN KEY (team_id) REFERENCES team (id)'); + $this->addSql('ALTER TABLE team_admin ADD CONSTRAINT RFX_user_id_team_admin_6704f59cda242 FOREIGN KEY (user_id) REFERENCES user (id)'); + $this->addSql('CREATE UNIQUE INDEX team_admin_IdX ON team_admin (id)'); + $this->addSql('ALTER TABLE user RENAME INDEX idx_8d93d6499e73ac3e TO IDX_957A64799E73AC3E'); + $this->addSql('ALTER TABLE user_team DROP FOREIGN KEY FK_BE61EAD6A76ED395'); + $this->addSql('ALTER TABLE user_team DROP FOREIGN KEY FK_BE61EAD6296CD8AE'); + $this->addSql('ALTER TABLE user_team ADD id INT AUTO_INCREMENT NOT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (id)'); + $this->addSql('ALTER TABLE user_team ADD CONSTRAINT RFX_team_id_user_team_6704f59cda128 FOREIGN KEY (team_id) REFERENCES team (id)'); + $this->addSql('ALTER TABLE user_team ADD CONSTRAINT RFX_user_id_user_team_6704f59cd9f23 FOREIGN KEY (user_id) REFERENCES user (id)'); + $this->addSql('CREATE UNIQUE INDEX user_team_IdX ON user_team (id)'); + } +}