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 @@
-
-
-
-
-
-
-
-
-
- {{
- t('mfazones', 'Cancel note creation') }}
-
-
- {{
- t('mfazones', 'Delete note') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{
- t('mfazones', 'Create a note to get started') }}
-
-
-
-
-
-
-
diff --git a/src/main.js b/src/main.js
deleted file mode 100644
index fc231e3..0000000
--- a/src/main.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * SPDX-FileCopyrightText: 2018 John Molakvoæ
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-import { generateFilePath } from '@nextcloud/router'
-
-import Vue from 'vue'
-import App from './App'
-
-// eslint-disable-next-line
-__webpack_public_path__ = generateFilePath(appName, '', 'js/')
-
-Vue.mixin({ methods: { t, n } })
-
-export default new Vue({
- el: '#content',
- render: h => h(App),
-})
diff --git a/tests/Unit/Controller/MfaVerifiedZoneControllerTest.php b/tests/Unit/Controller/MfaVerifiedZoneControllerTest.php
index c596f67..52c6735 100644
--- a/tests/Unit/Controller/MfaVerifiedZoneControllerTest.php
+++ b/tests/Unit/Controller/MfaVerifiedZoneControllerTest.php
@@ -1,8 +1,11 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
namespace OCA\mfazones\Controller\Tests;
-use OCA\mfazones\Controller\mfazonesController;
+use OCA\mfazones\Controller\MfazonesController;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\TemplateResponse;
@@ -14,6 +17,7 @@
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserManager;
+use OCP\ISession;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\ISystemTagObjectMapper;
use OC\SystemTag\SystemTag;
@@ -48,6 +52,9 @@ class mfazonesControllerTest extends \Test\TestCase
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
private $user;
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
+ private $session;
+
/** @var array */
private $tags;
@@ -61,16 +68,18 @@ protected function setUp(): void
$this->tagManager = $this->createMock(\OCP\ITagManager::class);
$this->tagMapper = $this->createMock(ISystemTagObjectMapper::class);
$this->user = $this->createMock(IUser::class);
+ $this->session = $this->createMock(ISession::class);
$this->tags = [];
$this->tags[1] = new SystemTag("1", "mfazone", false, false);;
- $this->controller = new mfazonesController(
+ $this->controller = new MfazonesController(
$this->request,
$this->userManager,
$this->rootFolder,
$this->groupManager,
$this->tagManager,
"user1",
+ $this->session,
$this->tagMapper,
$this->systemTagManager
);
@@ -105,7 +114,8 @@ public function testGet(): void
// Set up the expected response
$expectedResponse = new JSONResponse([
- "status" => true
+ "status" => true,
+ "mfa_passed" => false
]);
// Mock the root folder and user manager
@@ -139,7 +149,7 @@ public function testGet(): void
);
}
- public function testHasUserAccess(): void
+ public function testUserHasNotAccess(): void
{
$node = $this->createMock(Node::class);
$node->method("getOwner")->willReturn($this->user);
@@ -149,9 +159,10 @@ public function testHasUserAccess(): void
$this->rootFolder->method("getUserFolder")->willReturn($userRoot);
$this->groupManager->method("isAdmin")->willReturn(false);
+
// Test user has access to own file
$this->user->method("getUID")->willReturn("user1");
- $this->assertTrue($this->controller->hasAccess("id1"));
+ $this->assertFalse($this->controller->hasAccess("id1"));
}
public function testHasNotUserAccess(): void