From b2ba3122399dbedd051e776c40da0a789c4013c9 Mon Sep 17 00:00:00 2001 From: MohammadReza vahedi Date: Mon, 18 Sep 2023 11:44:12 +0000 Subject: [PATCH] fix CI and cleanup Signed-off-by: MohammadReza vahedi --- .github/workflows/lint-eslint.yml | 47 ---- .github/workflows/lint-php-cs.yml | 38 --- .github/workflows/lint-stylelint.yml | 46 ---- .github/workflows/phpunit-mysql.yml | 117 --------- .github/workflows/phpunit-pgsql.yml | 116 --------- .github/workflows/phpunit-sqlite.yml | 105 -------- .reuse/info.xml | 1 - README.md | 2 + appinfo/info.xml | 1 - appinfo/routes.php | 4 + css/tabview.css | 2 + js/plugin.js | 2 + js/tabview.js | 2 + lib/Controller/MfazonesController.php | 2 + lib/Service/MfazonesService.php | 18 -- lib/Setting/MfaZoneSettings.php | 3 + src/App.vue | 241 ------------------ src/main.js | 19 -- .../MfaVerifiedZoneControllerTest.php | 21 +- 19 files changed, 33 insertions(+), 754 deletions(-) delete mode 100644 .github/workflows/lint-eslint.yml delete mode 100644 .github/workflows/lint-php-cs.yml delete mode 100644 .github/workflows/lint-stylelint.yml delete mode 100644 .github/workflows/phpunit-mysql.yml delete mode 100644 .github/workflows/phpunit-pgsql.yml delete mode 100644 .github/workflows/phpunit-sqlite.yml delete mode 100644 lib/Service/MfazonesService.php delete mode 100644 src/App.vue delete mode 100644 src/main.js diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml deleted file mode 100644 index 34f766b..0000000 --- a/.github/workflows/lint-eslint.yml +++ /dev/null @@ -1,47 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization -# SPDX-FileCopyrightText: Nextcloud contributors -# SPDX-License-Identifier: AGPL-3.0-or-later - -name: Lint - -on: - pull_request: - push: - branches: - - main - - master - - stable* - -jobs: - lint: - runs-on: ubuntu-latest - - name: eslint - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Read package.json node and npm engines version - uses: skjnldsv/read-package-engines-version-actions@v1.2 - id: versions - with: - fallbackNode: '^12' - fallbackNpm: '^6' - - - name: Set up node $ - uses: actions/setup-node@v3 - with: - node-version: $ - - - name: Set up npm $ - run: npm i -g npm@"$" - - - name: Install dependencies - run: npm ci - - - name: Lint - run: npm run lint diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml deleted file mode 100644 index 55f08f3..0000000 --- a/.github/workflows/lint-php-cs.yml +++ /dev/null @@ -1,38 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization -# SPDX-FileCopyrightText: Nextcloud contributors -# SPDX-License-Identifier: AGPL-3.0-or-later - -name: Lint - -on: - pull_request: - push: - branches: - - master - - stable* - -jobs: - lint: - runs-on: ubuntu-latest - - name: php-cs - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 - with: - php-version: "7.4" - coverage: none - - - name: Install dependencies - run: composer i - - - name: Lint - run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 ) - diff --git a/.github/workflows/lint-stylelint.yml b/.github/workflows/lint-stylelint.yml deleted file mode 100644 index c3fcd06..0000000 --- a/.github/workflows/lint-stylelint.yml +++ /dev/null @@ -1,46 +0,0 @@ -# This workflow is provided via the organization template repository -# -# https://github.com/nextcloud/.github -# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization -# SPDX-FileCopyrightText: Nextcloud contributors -# SPDX-License-Identifier: AGPL-3.0-or-later - -name: Lint - -on: - pull_request: - push: - branches: - - master - - stable* - -jobs: - lint: - runs-on: ubuntu-latest - - name: stylelint - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Read package.json node and npm engines version - uses: skjnldsv/read-package-engines-version-actions@v1.1 - id: versions - with: - fallbackNode: '^12' - fallbackNpm: '^6' - - - name: Set up node $ - uses: actions/setup-node@v2 - with: - node-version: $ - - - name: Set up npm $ - run: npm i -g npm@"$" - - - name: Install dependencies - run: npm ci - - - name: Lint - run: npm run stylelint diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml deleted file mode 100644 index 11422d0..0000000 --- a/.github/workflows/phpunit-mysql.yml +++ /dev/null @@ -1,117 +0,0 @@ - -# SPDX-FileCopyrightText: Nextcloud contributors -# SPDX-License-Identifier: AGPL-3.0-or-later -name: PHPUnit - -on: - pull_request: - push: - branches: - - master - - stable* - -env: - # Location of the phpunit.xml and phpunit.integration.xml files - PHPUNIT_CONFIG: ./tests/phpunit.xml - PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml - -jobs: - phpunit-mysql: - runs-on: ubuntu-latest - - strategy: - matrix: - php-versions: ['7.4', '8.0', '8.1'] - server-versions: ['master'] - - services: - mysql: - image: mariadb:10.5 - ports: - - 4444:3306/tcp - env: - MYSQL_ROOT_PASSWORD: rootpassword - options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 - - steps: - - name: Set app env - run: | - # Split and keep last - echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Enable ONLY_FULL_GROUP_BY MySQL option - run: | - echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - - - name: Checkout server - uses: actions/checkout@v3 - with: - submodules: true - repository: nextcloud/server - ref: ${{ matrix.server-versions }} - - - name: Checkout app - uses: actions/checkout@v3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - tools: phpunit - extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql - coverage: none - - - name: Set up PHPUnit - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password - ./occ app:enable ${{ env.APP_NAME }} - - - name: Check PHPUnit config file existence - id: check_phpunit - uses: andstor/file-existence-action@v1 - with: - files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }} - - - name: Run Nextcloud - run: php -S localhost:8080 & - - - name: PHPUnit - # Only run if phpunit config file exists - if: steps.check_phpunit.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }} - - - name: Check PHPUnit integration config file existence - id: check_integration - uses: andstor/file-existence-action@v1 - with: - files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }} - - - name: PHPUnit integration - # Only run if phpunit integration config file exists - if: steps.check_integration.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }} - - summary: - runs-on: ubuntu-latest - needs: phpunit-mysql - - if: always() - - name: phpunit-mysql-summary - - steps: - - name: Summary status - run: if ${{ needs.phpunit-mysql.result != 'success' }}; then exit 1; fi - diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml deleted file mode 100644 index 61d8d85..0000000 --- a/.github/workflows/phpunit-pgsql.yml +++ /dev/null @@ -1,116 +0,0 @@ - -# SPDX-FileCopyrightText: Nextcloud contributors -# SPDX-License-Identifier: AGPL-3.0-or-later -name: PHPUnit - -on: - pull_request: - push: - branches: - - master - - stable* - -env: - # Location of the phpunit.xml and phpunit.integration.xml files - PHPUNIT_CONFIG: ./tests/phpunit.xml - PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml - -jobs: - phpunit-pgsql: - runs-on: ubuntu-latest - - strategy: - matrix: - php-versions: ['8.0'] - server-versions: ['master'] - - services: - postgres: - image: postgres - ports: - - 4444:5432/tcp - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: rootpassword - POSTGRES_DB: nextcloud - options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 - - steps: - - name: Set app env - run: | - # Split and keep last - echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout server - uses: actions/checkout@v3 - with: - submodules: true - repository: nextcloud/server - ref: ${{ matrix.server-versions }} - - - name: Checkout app - uses: actions/checkout@v3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - tools: phpunit - extensions: mbstring, iconv, fileinfo, intl, pgsql, pdo_pgsql - coverage: none - - - name: Set up PHPUnit - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password - ./occ app:enable ${{ env.APP_NAME }} - - - name: Check PHPUnit config file existence - id: check_phpunit - uses: andstor/file-existence-action@v1 - with: - files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }} - - - name: PHPUnit - # Only run if phpunit config file exists - if: steps.check_phpunit.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }} - - - name: Check PHPUnit integration config file existence - id: check_integration - uses: andstor/file-existence-action@v1 - with: - files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }} - - - name: Run Nextcloud - # Only run if phpunit integration config file exists - if: steps.check_integration.outputs.files_exists == 'true' - run: php -S localhost:8080 & - - - name: PHPUnit integration - # Only run if phpunit integration config file exists - if: steps.check_integration.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }} - - summary: - runs-on: ubuntu-latest - needs: phpunit-pgsql - - if: always() - - name: phpunit-pgsql-summary - - steps: - - name: Summary status - run: if ${{ needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi - diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml deleted file mode 100644 index c72fdde..0000000 --- a/.github/workflows/phpunit-sqlite.yml +++ /dev/null @@ -1,105 +0,0 @@ - -# SPDX-FileCopyrightText: Nextcloud contributors -# SPDX-License-Identifier: AGPL-3.0-or-later -name: PHPUnit - -on: - pull_request: - push: - branches: - - master - - stable* - -env: - # Location of the phpunit.xml and phpunit.integration.xml files - PHPUNIT_CONFIG: ./tests/phpunit.xml - PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml - -jobs: - phpunit-sqlite: - runs-on: ubuntu-latest - - strategy: - matrix: - php-versions: ['8.0'] - server-versions: ['master'] - - steps: - - name: Set app env - run: | - # Split and keep last - echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - - - name: Checkout server - uses: actions/checkout@v3 - with: - submodules: true - repository: nextcloud/server - ref: ${{ matrix.server-versions }} - - - name: Checkout app - uses: actions/checkout@v3 - with: - path: apps/${{ env.APP_NAME }} - - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - tools: phpunit - extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite - coverage: none - - - name: Set up PHPUnit - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - - name: Set up Nextcloud - env: - DB_PORT: 4444 - run: | - mkdir data - ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password - ./occ app:enable ${{ env.APP_NAME }} - - - name: Check PHPUnit config file existence - id: check_phpunit - uses: andstor/file-existence-action@v1 - with: - files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }} - - - name: PHPUnit - # Only run if phpunit config file exists - if: steps.check_phpunit.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }} - - - name: Check PHPUnit integration config file existence - id: check_integration - uses: andstor/file-existence-action@v1 - with: - files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }} - - - name: Run Nextcloud - # Only run if phpunit integration config file exists - if: steps.check_integration.outputs.files_exists == 'true' - run: php -S localhost:8080 & - - - name: PHPUnit integration - # Only run if phpunit integration config file exists - if: steps.check_integration.outputs.files_exists == 'true' - working-directory: apps/${{ env.APP_NAME }} - run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }} - - summary: - runs-on: ubuntu-latest - needs: phpunit-sqlite - - if: always() - - name: phpunit-sqlite-summary - - steps: - - name: Summary status - run: if ${{ needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi - diff --git a/.reuse/info.xml b/.reuse/info.xml index ba322af..96aaa3b 100644 --- a/.reuse/info.xml +++ b/.reuse/info.xml @@ -20,6 +20,5 @@ See the [README](https://github.com/pondersource/mfazones/blob/main/README.md) f https://github.com/pondersource/mfazones/issues - files_accesscontrol diff --git a/README.md b/README.md index 08e1d9c..1cceb92 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ + + # MFA Zones Nextcloud App This is a Nextcloud app that enables file owners and administrators to restrict access to files and folders based on whether or not a logged-in user has passed MFA (multi-factor authentication) verification. diff --git a/appinfo/info.xml b/appinfo/info.xml index 0c8e361..10e631f 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -20,6 +20,5 @@ See the [README](https://github.com/pondersource/mfazones/blob/main/README.md) f https://github.com/pondersource/mfazones/issues - files_accesscontrol diff --git a/appinfo/routes.php b/appinfo/routes.php index 9c8ac60..687b007 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -1,4 +1,8 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + return [ 'routes' => [ ['name' => 'mfazones#get', 'url' => '/get', 'verb' => 'GET'], diff --git a/css/tabview.css b/css/tabview.css index 58233ab..2fc2866 100644 --- a/css/tabview.css +++ b/css/tabview.css @@ -1,3 +1,5 @@ +/* SPDX-FileCopyrightText: Pondersource */ +/* SPDX-License-Identifier: AGPL-3.0-or-later */ #mfazoneTabView table { margin-left: .5em; } diff --git a/js/plugin.js b/js/plugin.js index 368520f..0562e7f 100644 --- a/js/plugin.js +++ b/js/plugin.js @@ -1,3 +1,5 @@ +// SPDX-FileCopyrightText: Pondersource +// SPDX-License-Identifier: AGPL-3.0-or-later var mfazoneFileListPlugin = { attach: function(fileList) { // if (fileList.id === 'trashbin' || fileList.id === 'files.public') { diff --git a/js/tabview.js b/js/tabview.js index 4c1d73d..3fd88e2 100644 --- a/js/tabview.js +++ b/js/tabview.js @@ -1,3 +1,5 @@ +// SPDX-FileCopyrightText: Pondersource +// SPDX-License-Identifier: AGPL-3.0-or-later (function () { const MfaZoneTabView = OCA.Files.DetailTabView.extend({ id: 'mfazoneTabView', diff --git a/lib/Controller/MfazonesController.php b/lib/Controller/MfazonesController.php index 679763c..dd1a321 100755 --- a/lib/Controller/MfazonesController.php +++ b/lib/Controller/MfazonesController.php @@ -1,4 +1,6 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later namespace OCA\mfazones\Controller; diff --git a/lib/Service/MfazonesService.php b/lib/Service/MfazonesService.php deleted file mode 100644 index 7b9646b..0000000 --- a/lib/Service/MfazonesService.php +++ /dev/null @@ -1,18 +0,0 @@ - -// SPDX-License-Identifier: AGPL-3.0-or-later - -namespace OCA\mfazones\Service; - -use Exception; - -use OCP\AppFramework\Db\DoesNotExistException; -use OCP\AppFramework\Db\MultipleObjectsReturnedException; - - -class MfazonesService { - - public function __construct() { - } -} diff --git a/lib/Setting/MfaZoneSettings.php b/lib/Setting/MfaZoneSettings.php index 1cd2cf2..1b9e4d2 100644 --- a/lib/Setting/MfaZoneSettings.php +++ b/lib/Setting/MfaZoneSettings.php @@ -1,5 +1,8 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + declare(strict_types=1); namespace OCA\MfaZone\Settings; diff --git a/src/App.vue b/src/App.vue deleted file mode 100644 index 03d6838..0000000 --- a/src/App.vue +++ /dev/null @@ -1,241 +0,0 @@ -