2
.github/workflows/phpunit.yml
vendored
2
.github/workflows/phpunit.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.4', '8.0', '8.1']
|
php-versions: ['7.4', '8.0']
|
||||||
databases: ['sqlite', 'mysql', 'pgsql']
|
databases: ['sqlite', 'mysql', 'pgsql']
|
||||||
server-versions: ['stable24']
|
server-versions: ['stable24']
|
||||||
|
|
||||||
|
|||||||
@@ -160,19 +160,19 @@ class PermissionService {
|
|||||||
throw new NoPermissionException('Permission denied');
|
throw new NoPermissionException('Permission denied');
|
||||||
}
|
}
|
||||||
|
|
||||||
$permissions = $this->getPermissions($boardId, $userId);
|
try {
|
||||||
if ($permissions[$permission] === true) {
|
$permissions = $this->getPermissions($boardId, $userId);
|
||||||
if (!$allowDeletedCard && $mapper instanceof CardMapper) {
|
if ($permissions[$permission] === true) {
|
||||||
$card = $mapper->find($id);
|
if (!$allowDeletedCard && $mapper instanceof CardMapper) {
|
||||||
if ($card->getDeletedAt() > 0) {
|
$card = $mapper->find($id);
|
||||||
throw new NoPermissionException('Card is deleted');
|
if ($card->getDeletedAt() > 0) {
|
||||||
|
throw new NoPermissionException('Card is deleted');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$acls = $this->getBoard((int)$boardId)->getAcl() ?? [];
|
$acls = $this->getBoard((int)$boardId)->getAcl() ?? [];
|
||||||
$result = $this->userCan($acls, $permission, $userId);
|
$result = $this->userCan($acls, $permission, $userId);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|||||||
@@ -240,6 +240,8 @@ class PermissionServiceTest extends \Test\TestCase {
|
|||||||
->method('sharingDisabledForUser')
|
->method('sharingDisabledForUser')
|
||||||
->willReturn(false);
|
->willReturn(false);
|
||||||
|
|
||||||
|
$this->aclMapper->method('findAll')->willReturn([]);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$actual = $this->service->checkPermission($mapper, 1234, $permission);
|
$actual = $this->service->checkPermission($mapper, 1234, $permission);
|
||||||
$this->assertTrue($actual);
|
$this->assertTrue($actual);
|
||||||
@@ -262,6 +264,8 @@ class PermissionServiceTest extends \Test\TestCase {
|
|||||||
$this->boardMapper->expects($this->any())->method('find')->willReturn($board);
|
$this->boardMapper->expects($this->any())->method('find')->willReturn($board);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->aclMapper->method('findAll')->willReturn([]);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$actual = $this->service->checkPermission($mapper, 1234, $permission);
|
$actual = $this->service->checkPermission($mapper, 1234, $permission);
|
||||||
$this->assertTrue($actual);
|
$this->assertTrue($actual);
|
||||||
|
|||||||
Reference in New Issue
Block a user