Compare commits
91 Commits
release/1.
...
stable0.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
634ae1103c | ||
|
|
69b6fc4d0a | ||
|
|
39a575782b | ||
|
|
ee47a82e62 | ||
|
|
5bd6752bc5 | ||
|
|
37cf13b141 | ||
|
|
1ce0643c6b | ||
|
|
ccc02e23b6 | ||
|
|
d1812b6801 | ||
|
|
6c0da2bea1 | ||
|
|
474dac00ff | ||
|
|
a599ffe992 | ||
|
|
e92f581049 | ||
|
|
07c53f8b4f | ||
|
|
112c809112 | ||
|
|
d8d1df7c74 | ||
|
|
5f75bebe6e | ||
|
|
227833d322 | ||
|
|
cf889e566b | ||
|
|
56a0a605cd | ||
|
|
87e6be6d10 | ||
|
|
3728e4b0d5 | ||
|
|
cfef011f03 | ||
|
|
0a82c0a137 | ||
|
|
b09d3d00b4 | ||
|
|
7c905528e7 | ||
|
|
aeba3787a3 | ||
|
|
033965d1cb | ||
|
|
0b5bc05116 | ||
|
|
2dc8e219f0 | ||
|
|
cd3b201ae8 | ||
|
|
daddeaa109 | ||
|
|
07ad95ee8c | ||
|
|
0882b15825 | ||
|
|
32f2561267 | ||
|
|
d54ee14268 | ||
|
|
013505bd4e | ||
|
|
83631f2888 | ||
|
|
83017ba262 | ||
|
|
0be1f13015 | ||
|
|
764b08e80b | ||
|
|
b8caa922ab | ||
|
|
c4a23ad4ff | ||
|
|
fe538b87a7 | ||
|
|
d178a4501b | ||
|
|
e8a6ef1116 | ||
|
|
2e182b6571 | ||
|
|
23f86231fd | ||
|
|
c6b25a6438 | ||
|
|
b7ce980f44 | ||
|
|
615210dde4 | ||
|
|
245d5a3eaf | ||
|
|
e865776575 | ||
|
|
8f89d34d9f | ||
|
|
c12a5ae879 | ||
|
|
da5ef24085 | ||
|
|
fd88a0b85a | ||
|
|
eca18e43f9 | ||
|
|
a7c302e7e0 | ||
|
|
609eaf6929 | ||
|
|
5130cc931a | ||
|
|
3de68ebfcd | ||
|
|
372935f190 | ||
|
|
fec0658102 | ||
|
|
1411c327cb | ||
|
|
c7c9edf2e3 | ||
|
|
97428b51ff | ||
|
|
52bcd0ec03 | ||
|
|
442d9bdedd | ||
|
|
d761649d44 | ||
|
|
5da9cf5c3f | ||
|
|
d66a913089 | ||
|
|
8999640459 | ||
|
|
e8b5577def | ||
|
|
3c52a85169 | ||
|
|
0f7a473c65 | ||
|
|
8dae2b28a6 | ||
|
|
ce1e93ab26 | ||
|
|
28352740d9 | ||
|
|
8de78a29ff | ||
|
|
8d40d95f0b | ||
|
|
de4ea71842 | ||
|
|
e9f7aef7a3 | ||
|
|
8accc8a020 | ||
|
|
3feb261e1b | ||
|
|
9275d8277a | ||
|
|
2980dad4f5 | ||
|
|
a88d19b3ce | ||
|
|
91b968cc97 | ||
|
|
1e270389f6 | ||
|
|
a2649885a5 |
22
.drone.yml
22
.drone.yml
@@ -5,7 +5,7 @@ steps:
|
|||||||
image: nextcloudci/php7.2:php7.2-13
|
image: nextcloudci/php7.2:php7.2-13
|
||||||
environment:
|
environment:
|
||||||
APP_NAME: deck
|
APP_NAME: deck
|
||||||
CORE_BRANCH: master
|
CORE_BRANCH: stable17
|
||||||
DB: sqlite
|
DB: sqlite
|
||||||
commands:
|
commands:
|
||||||
# Pre-setup steps
|
# Pre-setup steps
|
||||||
@@ -20,7 +20,7 @@ steps:
|
|||||||
image: nextcloudci/php7.2:php7.2-13
|
image: nextcloudci/php7.2:php7.2-13
|
||||||
environment:
|
environment:
|
||||||
APP_NAME: deck
|
APP_NAME: deck
|
||||||
CORE_BRANCH: master
|
CORE_BRANCH: stable17
|
||||||
DB: sqlite
|
DB: sqlite
|
||||||
commands:
|
commands:
|
||||||
- composer install
|
- composer install
|
||||||
@@ -29,7 +29,7 @@ steps:
|
|||||||
image: nextcloudci/php7.3:php7.3-2
|
image: nextcloudci/php7.3:php7.3-2
|
||||||
environment:
|
environment:
|
||||||
APP_NAME: deck
|
APP_NAME: deck
|
||||||
CORE_BRANCH: master
|
CORE_BRANCH: stable17
|
||||||
DB: sqlite
|
DB: sqlite
|
||||||
commands:
|
commands:
|
||||||
- composer install
|
- composer install
|
||||||
@@ -38,7 +38,7 @@ steps:
|
|||||||
image: nextcloudci/php7.4:2
|
image: nextcloudci/php7.4:2
|
||||||
environment:
|
environment:
|
||||||
APP_NAME: deck
|
APP_NAME: deck
|
||||||
CORE_BRANCH: master
|
CORE_BRANCH: stable17
|
||||||
DB: sqlite
|
DB: sqlite
|
||||||
commands:
|
commands:
|
||||||
- composer install
|
- composer install
|
||||||
@@ -58,7 +58,7 @@ steps:
|
|||||||
image: nextcloudci/php7.2:php7.2-13
|
image: nextcloudci/php7.2:php7.2-13
|
||||||
environment:
|
environment:
|
||||||
APP_NAME: deck
|
APP_NAME: deck
|
||||||
CORE_BRANCH: master
|
CORE_BRANCH: stable17
|
||||||
DB: sqlite
|
DB: sqlite
|
||||||
commands:
|
commands:
|
||||||
# Pre-setup steps
|
# Pre-setup steps
|
||||||
@@ -68,8 +68,8 @@ steps:
|
|||||||
- php occ app:enable deck
|
- php occ app:enable deck
|
||||||
- cd apps/$APP_NAME
|
- cd apps/$APP_NAME
|
||||||
- composer install
|
- composer install
|
||||||
- phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
|
- ./vendor/bin/phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
|
||||||
- phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
|
- ./vendor/bin/phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- master
|
- master
|
||||||
@@ -85,7 +85,7 @@ steps:
|
|||||||
image: nextcloudci/php7.3:php7.3-5
|
image: nextcloudci/php7.3:php7.3-5
|
||||||
environment:
|
environment:
|
||||||
APP_NAME: deck
|
APP_NAME: deck
|
||||||
CORE_BRANCH: master
|
CORE_BRANCH: stable17
|
||||||
DB: sqlite
|
DB: sqlite
|
||||||
commands:
|
commands:
|
||||||
# Pre-setup steps
|
# Pre-setup steps
|
||||||
@@ -95,8 +95,8 @@ steps:
|
|||||||
- php occ app:enable deck
|
- php occ app:enable deck
|
||||||
- cd apps/$APP_NAME
|
- cd apps/$APP_NAME
|
||||||
- composer install
|
- composer install
|
||||||
- phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
|
- ./vendor/bin/phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
|
||||||
- phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
|
- ./vendor/bin/phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- master
|
- master
|
||||||
@@ -112,7 +112,7 @@ steps:
|
|||||||
image: nextcloudci/php7.2:php7.2-13
|
image: nextcloudci/php7.2:php7.2-13
|
||||||
environment:
|
environment:
|
||||||
APP_NAME: deck
|
APP_NAME: deck
|
||||||
CORE_BRANCH: master
|
CORE_BRANCH: stable17
|
||||||
DB: sqlite
|
DB: sqlite
|
||||||
commands:
|
commands:
|
||||||
# Pre-setup steps
|
# Pre-setup steps
|
||||||
|
|||||||
31
.nextcloudignore
Normal file
31
.nextcloudignore
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/build/
|
||||||
|
/.git
|
||||||
|
/js/node_modules
|
||||||
|
/js/tests
|
||||||
|
/js/legacy
|
||||||
|
/js/controller
|
||||||
|
/js/directive
|
||||||
|
/js/filters
|
||||||
|
/js/service
|
||||||
|
/js/bower.json
|
||||||
|
/js/.bowerrc
|
||||||
|
/js/.jshintrc
|
||||||
|
/js/Gruntfile.js
|
||||||
|
/js/package.json
|
||||||
|
/js/package-lock.json
|
||||||
|
/docs/
|
||||||
|
/tests
|
||||||
|
/.codecov.yml
|
||||||
|
/composer.json
|
||||||
|
/composer.lock
|
||||||
|
/_config.yml
|
||||||
|
/.drone.yml
|
||||||
|
/.travis.yml
|
||||||
|
/.eslintignore
|
||||||
|
/.eslintrc.yml
|
||||||
|
/.gitignore
|
||||||
|
/issue_template.md
|
||||||
|
/krankerl.toml
|
||||||
|
/Makefile
|
||||||
|
/mkdocs.yml
|
||||||
|
/run-eslint.sh
|
||||||
@@ -5,7 +5,7 @@ php:
|
|||||||
- 7.2
|
- 7.2
|
||||||
- 7.3
|
- 7.3
|
||||||
env:
|
env:
|
||||||
- CORE_BRANCH=master DB=mysql
|
- CORE_BRANCH=stable17 DB=mysql
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- export PATH="$PWD/vendor/bin:$PATH"
|
- export PATH="$PWD/vendor/bin:$PATH"
|
||||||
|
|||||||
20
CHANGELOG.md
20
CHANGELOG.md
@@ -1,6 +1,26 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## 0.8.3 - 2020-06-26
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Bump dependencies
|
||||||
|
|
||||||
|
## 0.8.2 - 2020-04-08
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Fix build with missing javascript bundles
|
||||||
|
|
||||||
|
## 0.8.1 - 2020-04-08
|
||||||
|
|
||||||
|
## Added
|
||||||
|
- Nextcloud 19 compatibility
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Let new shares only use the current users permissions
|
||||||
|
- Check for board membership on comments entity event
|
||||||
|
|
||||||
## 0.8.0 - 2020-01-16
|
## 0.8.0 - 2020-01-16
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|||||||
12
Makefile
12
Makefile
@@ -81,16 +81,8 @@ test: test-unit test-integration
|
|||||||
|
|
||||||
test-unit:
|
test-unit:
|
||||||
mkdir -p build/
|
mkdir -p build/
|
||||||
ifeq (, $(shell which phpunit 2> /dev/null))
|
./vendor/bin/phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
|
||||||
@echo "No phpunit command available, downloading a copy from the web"
|
./vendor/bin/phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
|
||||||
mkdir -p $(build_tools_directory)
|
|
||||||
curl -sSL https://phar.phpunit.de/phpunit-8.2.phar -o $(build_tools_directory)/phpunit.phar
|
|
||||||
php $(build_tools_directory)/phpunit.phar -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
|
|
||||||
php $(build_tools_directory)/phpunit.phar -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
|
|
||||||
else
|
|
||||||
phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
|
|
||||||
phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
|
|
||||||
endif
|
|
||||||
|
|
||||||
test-integration:
|
test-integration:
|
||||||
cd tests/integration && ./run.sh
|
cd tests/integration && ./run.sh
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
- 🚀 Get your project organized
|
- 🚀 Get your project organized
|
||||||
|
|
||||||
</description>
|
</description>
|
||||||
<version>0.8.0</version>
|
<version>0.8.3</version>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author>Julius Härtl</author>
|
<author>Julius Härtl</author>
|
||||||
<namespace>Deck</namespace>
|
<namespace>Deck</namespace>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<database min-version="9.4">pgsql</database>
|
<database min-version="9.4">pgsql</database>
|
||||||
<database>sqlite</database>
|
<database>sqlite</database>
|
||||||
<database min-version="5.5">mysql</database>
|
<database min-version="5.5">mysql</database>
|
||||||
<nextcloud min-version="17" max-version="19" />
|
<nextcloud min-version="17" max-version="17" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<background-jobs>
|
<background-jobs>
|
||||||
<job>OCA\Deck\Cron\DeleteCron</job>
|
<job>OCA\Deck\Cron\DeleteCron</job>
|
||||||
|
|||||||
@@ -15,6 +15,6 @@
|
|||||||
"roave/security-advisories": "dev-master",
|
"roave/security-advisories": "dev-master",
|
||||||
"christophwurst/nextcloud": "^17",
|
"christophwurst/nextcloud": "^17",
|
||||||
"jakub-onderka/php-parallel-lint": "^1.0.0",
|
"jakub-onderka/php-parallel-lint": "^1.0.0",
|
||||||
"phpunit/phpunit": "^8"
|
"phpunit/phpunit": "6.5.*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4834
js/package-lock.json
generated
4834
js/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -7,12 +7,12 @@
|
|||||||
"test": "tests"
|
"test": "tests"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uirouter/angularjs": "^1.0.24",
|
"@uirouter/angularjs": "^1.0.28",
|
||||||
"angular": "^1.7.9",
|
"angular": "^1.8.0",
|
||||||
"angular-animate": "^1.7.9",
|
"angular-animate": "^1.8.0",
|
||||||
"angular-file-upload": "^2.5.0",
|
"angular-file-upload": "^2.6.1",
|
||||||
"angular-markdown-it": "^0.6.1",
|
"angular-markdown-it": "^0.6.1",
|
||||||
"angular-sanitize": "^1.7.9",
|
"angular-sanitize": "^1.8.0",
|
||||||
"babel-polyfill": "^6.26.0",
|
"babel-polyfill": "^6.26.0",
|
||||||
"markdown-it": "^10.0.0",
|
"markdown-it": "^10.0.0",
|
||||||
"markdown-it-link-target": "^1.0.2",
|
"markdown-it-link-target": "^1.0.2",
|
||||||
@@ -22,25 +22,26 @@
|
|||||||
"ng-infinite-scroll": "^1.3.0",
|
"ng-infinite-scroll": "^1.3.0",
|
||||||
"ng-sortable": "^1.3.8",
|
"ng-sortable": "^1.3.8",
|
||||||
"ui-select": "^0.19.8",
|
"ui-select": "^0.19.8",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.12",
|
||||||
"vuex": "^3.1.2"
|
"vuex": "^3.5.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.8.3",
|
"@babel/core": "^7.11.4",
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||||
"@babel/polyfill": "^7.8.3",
|
"@babel/polyfill": "^7.10.4",
|
||||||
"@babel/preset-env": "^7.8.3",
|
"@babel/preset-env": "^7.11.0",
|
||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.1.0",
|
||||||
"css-loader": "^3.4.2",
|
"css-loader": "^3.6.0",
|
||||||
"karma": "^4.4.1",
|
"karma": "^5.1.1",
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
"mini-css-extract-plugin": "^0.9.0",
|
||||||
"style-loader": "^1.1.3",
|
"minimist": "^1.2.5",
|
||||||
"url-loader": "^3.0.0",
|
"style-loader": "^1.2.1",
|
||||||
"vue-loader": "^15.8.3",
|
"url-loader": "^4.1.0",
|
||||||
|
"vue-loader": "^15.9.3",
|
||||||
"vue-style-loader": "^4.1.2",
|
"vue-style-loader": "^4.1.2",
|
||||||
"vue-template-compiler": "^2.6.11",
|
"vue-template-compiler": "^2.6.12",
|
||||||
"webpack": "^4.41.5",
|
"webpack": "^4.44.1",
|
||||||
"webpack-cli": "^3.3.10",
|
"webpack-cli": "^3.3.12",
|
||||||
"webpack-merge": "^4.2.2"
|
"webpack-merge": "^4.2.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,38 +1,4 @@
|
|||||||
[package]
|
[package]
|
||||||
exclude = [
|
|
||||||
"build/",
|
|
||||||
".git",
|
|
||||||
"js/node_modules",
|
|
||||||
"js/tests",
|
|
||||||
"js/legacy",
|
|
||||||
"js/controller",
|
|
||||||
"js/directive",
|
|
||||||
"js/filters",
|
|
||||||
"js/service",
|
|
||||||
"js/bower.json",
|
|
||||||
"js/.bowerrc",
|
|
||||||
"js/.jshintrc",
|
|
||||||
"js/Gruntfile.js",
|
|
||||||
"js/package.json",
|
|
||||||
"js/package-lock.json",
|
|
||||||
"docs/",
|
|
||||||
"tests",
|
|
||||||
".codecov.yml",
|
|
||||||
"composer.json",
|
|
||||||
"composer.lock",
|
|
||||||
"_config.yml",
|
|
||||||
".drone.yml",
|
|
||||||
".travis.yml",
|
|
||||||
".eslintignore",
|
|
||||||
".eslintrc.yml",
|
|
||||||
".gitignore",
|
|
||||||
"issue_template.md",
|
|
||||||
"krankerl.toml",
|
|
||||||
"Makefile",
|
|
||||||
"mkdocs.yml",
|
|
||||||
"run-eslint.sh"
|
|
||||||
]
|
|
||||||
|
|
||||||
before_cmds = [
|
before_cmds = [
|
||||||
'make clean-build',
|
'make clean-build',
|
||||||
'make build'
|
'make build'
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ use OCA\Deck\Db\CardMapper;
|
|||||||
use OCA\Deck\Middleware\ExceptionMiddleware;
|
use OCA\Deck\Middleware\ExceptionMiddleware;
|
||||||
use OCA\Deck\Notification\Notifier;
|
use OCA\Deck\Notification\Notifier;
|
||||||
use OCA\Deck\Service\FullTextSearchService;
|
use OCA\Deck\Service\FullTextSearchService;
|
||||||
|
use OCA\Deck\Service\PermissionService;
|
||||||
use OCP\AppFramework\App;
|
use OCP\AppFramework\App;
|
||||||
use OCP\Collaboration\Resources\IManager;
|
use OCP\Collaboration\Resources\IManager;
|
||||||
use OCP\Comments\CommentsEntityEvent;
|
use OCP\Comments\CommentsEntityEvent;
|
||||||
@@ -151,13 +152,14 @@ class Application extends App {
|
|||||||
$this->getContainer()->getServer()->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
|
$this->getContainer()->getServer()->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
|
||||||
$event->addEntityCollection('deckCard', function($name) {
|
$event->addEntityCollection('deckCard', function($name) {
|
||||||
/** @var CardMapper */
|
/** @var CardMapper */
|
||||||
$service = $this->getContainer()->query(CardMapper::class);
|
$cardMapper = $this->getContainer()->query(CardMapper::class);
|
||||||
|
$permissionService = $this->getContainer()->query(PermissionService::class);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$service->find((int) $name);
|
return $permissionService->checkPermission($cardMapper, (int) $name, Acl::PERMISSION_READ);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$this->registerCommentsEventHandler();
|
$this->registerCommentsEventHandler();
|
||||||
|
|||||||
@@ -454,6 +454,17 @@ class BoardService {
|
|||||||
return $board;
|
return $board;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function applyPermissions($boardId, $edit, $share, $manage) {
|
||||||
|
try {
|
||||||
|
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_MANAGE);
|
||||||
|
} catch (NoPermissionException $e) {
|
||||||
|
$acls = $this->aclMapper->findAll($boardId);
|
||||||
|
$edit = $this->permissionService->userCan($acls, Acl::PERMISSION_EDIT, $this->userId) && $edit;
|
||||||
|
$share = $this->permissionService->userCan($acls, Acl::PERMISSION_SHARE, $this->userId) && $share;
|
||||||
|
$manage = $this->permissionService->userCan($acls, Acl::PERMISSION_MANAGE, $this->userId) && $manage;
|
||||||
|
}
|
||||||
|
return [$edit, $share, $manage];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $boardId
|
* @param $boardId
|
||||||
@@ -493,6 +504,8 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_SHARE);
|
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_SHARE);
|
||||||
|
[$edit, $share, $manage] = $this->applyPermissions($boardId, $edit, $share, $manage);
|
||||||
|
|
||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setBoardId($boardId);
|
$acl->setBoardId($boardId);
|
||||||
$acl->setType($type);
|
$acl->setType($type);
|
||||||
@@ -555,8 +568,10 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->aclMapper, $id, Acl::PERMISSION_SHARE);
|
$this->permissionService->checkPermission($this->aclMapper, $id, Acl::PERMISSION_SHARE);
|
||||||
|
|
||||||
/** @var Acl $acl */
|
/** @var Acl $acl */
|
||||||
$acl = $this->aclMapper->find($id);
|
$acl = $this->aclMapper->find($id);
|
||||||
|
[$edit, $share, $manage] = $this->applyPermissions($acl->getBoardId(), $edit, $share, $manage);
|
||||||
$acl->setPermissionEdit($edit);
|
$acl->setPermissionEdit($edit);
|
||||||
$acl->setPermissionShare($share);
|
$acl->setPermissionShare($share);
|
||||||
$acl->setPermissionManage($manage);
|
$acl->setPermissionManage($manage);
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class ActivityManagerTest extends TestCase {
|
|||||||
if (strpos($constant, 'SUBJECT') === 0) {
|
if (strpos($constant, 'SUBJECT') === 0) {
|
||||||
$format = $this->activityManager->getActivityFormat($value, [], false);
|
$format = $this->activityManager->getActivityFormat($value, [], false);
|
||||||
if ($format !== '') {
|
if ($format !== '') {
|
||||||
$this->assertStringContainsString('{user}', $format);
|
$this->assertContains('{user}', $format);
|
||||||
} else {
|
} else {
|
||||||
/** @noinspection ForgottenDebugOutputInspection */
|
/** @noinspection ForgottenDebugOutputInspection */
|
||||||
print_r('No activity string found for '. $constant . PHP_EOL);
|
print_r('No activity string found for '. $constant . PHP_EOL);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ use OCA\Deck\Db\BoardMapper;
|
|||||||
use OCA\Deck\Db\ChangeHelper;
|
use OCA\Deck\Db\ChangeHelper;
|
||||||
use OCA\Deck\Db\LabelMapper;
|
use OCA\Deck\Db\LabelMapper;
|
||||||
use OCA\Deck\Db\StackMapper;
|
use OCA\Deck\Db\StackMapper;
|
||||||
|
use OCA\Deck\NoPermissionException;
|
||||||
use OCA\Deck\Notification\NotificationHelper;
|
use OCA\Deck\Notification\NotificationHelper;
|
||||||
use OCP\IUser;
|
use OCP\IUser;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
@@ -260,6 +261,93 @@ class BoardServiceTest extends TestCase {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dataAddAclExtendPermission() {
|
||||||
|
return [
|
||||||
|
[[false, false, false], [false, false, false], [false, false, false]],
|
||||||
|
[[false, false, false], [true, true, true], [false, false, false]],
|
||||||
|
|
||||||
|
// user has share permissions -> can only reshare with those
|
||||||
|
[[false, true, false], [false, false, false], [false, false, false]],
|
||||||
|
[[false, true, false], [false, true, false], [false, true, false]],
|
||||||
|
[[false, true, false], [true, true, true], [false, true, false]],
|
||||||
|
|
||||||
|
// user has write permissions -> can only reshare with those
|
||||||
|
[[true, true, false], [false, false, false], [false, false, false]],
|
||||||
|
[[true, true, false], [false, true, false], [false, true, false]],
|
||||||
|
[[true, true, false], [true, true, true], [true, true, false]],
|
||||||
|
|
||||||
|
// user has manage permissions -> can upgrade acl permissions
|
||||||
|
[[false, false, true], [true, true, true], [true, true, true]],
|
||||||
|
[[true, true, true], [false, false, true], [false, false, true]],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider dataAddAclExtendPermission
|
||||||
|
* @param $currentUserAcl
|
||||||
|
* @param $providedAcl
|
||||||
|
* @param $resultingAcl
|
||||||
|
* @throws NoPermissionException
|
||||||
|
* @throws \OCA\Deck\BadRequestException
|
||||||
|
*/
|
||||||
|
public function testAddAclExtendPermission($currentUserAcl, $providedAcl, $resultingAcl) {
|
||||||
|
$existingAcl = new Acl();
|
||||||
|
$existingAcl->setBoardId(123);
|
||||||
|
$existingAcl->setType('user');
|
||||||
|
$existingAcl->setParticipant('admin');
|
||||||
|
$existingAcl->setPermissionEdit($currentUserAcl[0]);
|
||||||
|
$existingAcl->setPermissionShare($currentUserAcl[1]);
|
||||||
|
$existingAcl->setPermissionManage($currentUserAcl[2]);
|
||||||
|
$this->permissionService->expects($this->at(0))
|
||||||
|
->method('checkPermission')
|
||||||
|
->with($this->boardMapper, 123, Acl::PERMISSION_SHARE, null);
|
||||||
|
if ($currentUserAcl[2]) {
|
||||||
|
$this->permissionService->expects($this->at(1))
|
||||||
|
->method('checkPermission')
|
||||||
|
->with($this->boardMapper, 123, Acl::PERMISSION_MANAGE, null);
|
||||||
|
} else {
|
||||||
|
$this->aclMapper->expects($this->once())
|
||||||
|
->method('findAll')
|
||||||
|
->willReturn([$existingAcl]);
|
||||||
|
$this->permissionService->expects($this->at(1))
|
||||||
|
->method('checkPermission')
|
||||||
|
->with($this->boardMapper, 123, Acl::PERMISSION_MANAGE, null)
|
||||||
|
->willThrowException(new NoPermissionException('No permission'));
|
||||||
|
$this->permissionService->expects($this->at(2))
|
||||||
|
->method('userCan')
|
||||||
|
->willReturn($currentUserAcl[0]);
|
||||||
|
$this->permissionService->expects($this->at(3))
|
||||||
|
->method('userCan')
|
||||||
|
->willReturn($currentUserAcl[1]);
|
||||||
|
$this->permissionService->expects($this->at(4))
|
||||||
|
->method('userCan')
|
||||||
|
->willReturn($currentUserAcl[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = $this->createMock(IUser::class);
|
||||||
|
$user->method('getUID')->willReturn('admin');
|
||||||
|
$acl = new Acl();
|
||||||
|
$acl->setBoardId(123);
|
||||||
|
$acl->setType('user');
|
||||||
|
$acl->setParticipant('admin');
|
||||||
|
$acl->setPermissionEdit($resultingAcl[0]);
|
||||||
|
$acl->setPermissionShare($resultingAcl[1]);
|
||||||
|
$acl->setPermissionManage($resultingAcl[2]);
|
||||||
|
$acl->resolveRelation('participant', function($participant) use (&$user) {
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
$this->notificationHelper->expects($this->once())
|
||||||
|
->method('sendBoardShared');
|
||||||
|
$expected = clone $acl;
|
||||||
|
$this->aclMapper->expects($this->once())
|
||||||
|
->method('insert')
|
||||||
|
->with($acl)
|
||||||
|
->willReturn($acl);
|
||||||
|
$this->assertEquals($expected, $this->service->addAcl(
|
||||||
|
123, 'user', 'admin', $providedAcl[0], $providedAcl[1], $providedAcl[2]
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public function testUpdateAcl() {
|
public function testUpdateAcl() {
|
||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setBoardId(123);
|
$acl->setBoardId(123);
|
||||||
|
|||||||
Reference in New Issue
Block a user