fix: PHP 7.4 compatibility
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
lib/Service/CardService.php<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
||||||
*
|
*
|
||||||
@@ -264,7 +264,7 @@ class CardService {
|
|||||||
public function update($id, $title, $stackId, $type, $owner, $description = '', $order = 0, $duedate = null, $deletedAt = null, $archived = null) {
|
public function update($id, $title, $stackId, $type, $owner, $description = '', $order = 0, $duedate = null, $deletedAt = null, $archived = null) {
|
||||||
$this->cardServiceValidator->check(compact('id', 'title', 'stackId', 'type', 'owner', 'order'));
|
$this->cardServiceValidator->check(compact('id', 'title', 'stackId', 'type', 'owner', 'order'));
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT, allowDeletedCard: true);
|
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT, null, true);
|
||||||
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT);
|
||||||
|
|
||||||
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||||
|
|||||||
@@ -83,10 +83,6 @@ class CommentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $cardId
|
|
||||||
* @param string $message
|
|
||||||
* @param string $replyTo
|
|
||||||
* @return DataResponse
|
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws NotFoundException|NoPermissionException
|
* @throws NotFoundException|NoPermissionException
|
||||||
*/
|
*/
|
||||||
@@ -142,7 +138,7 @@ class CommentService {
|
|||||||
throw new NoPermissionException('Only authors are allowed to edit their comment.');
|
throw new NoPermissionException('Only authors are allowed to edit their comment.');
|
||||||
}
|
}
|
||||||
if ($comment->getParentId() !== '0') {
|
if ($comment->getParentId() !== '0') {
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $comment->getParentId(), Acl::PERMISSION_READ);
|
$this->permissionService->checkPermission($this->cardMapper, (int)$comment->getParentId(), Acl::PERMISSION_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment->setMessage($message);
|
$comment->setMessage($message);
|
||||||
|
|||||||
@@ -98,7 +98,11 @@ class PermissionService {
|
|||||||
* @param $boardId
|
* @param $boardId
|
||||||
* @return bool|array
|
* @return bool|array
|
||||||
*/
|
*/
|
||||||
public function getPermissions($boardId) {
|
public function getPermissions($boardId, ?string $userId = null) {
|
||||||
|
if ($userId === null) {
|
||||||
|
$userId = $this->userId;
|
||||||
|
}
|
||||||
|
|
||||||
if ($cached = $this->permissionCache->get($boardId)) {
|
if ($cached = $this->permissionCache->get($boardId)) {
|
||||||
return $cached;
|
return $cached;
|
||||||
}
|
}
|
||||||
@@ -113,7 +117,7 @@ class PermissionService {
|
|||||||
Acl::PERMISSION_SHARE => ($owner || $this->userCan($acls, Acl::PERMISSION_SHARE))
|
Acl::PERMISSION_SHARE => ($owner || $this->userCan($acls, Acl::PERMISSION_SHARE))
|
||||||
&& (!$this->shareManager->sharingDisabledForUser($this->userId))
|
&& (!$this->shareManager->sharingDisabledForUser($this->userId))
|
||||||
];
|
];
|
||||||
$this->permissionCache->set($boardId, $permissions);
|
$this->permissionCache->set((string)$boardId, $permissions);
|
||||||
return $permissions;
|
return $permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +173,7 @@ class PermissionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$acls = $this->getBoard($boardId)->getAcl() ?? [];
|
$acls = $this->getBoard((int)$boardId)->getAcl() ?? [];
|
||||||
$result = $this->userCan($acls, $permission, $userId);
|
$result = $this->userCan($acls, $permission, $userId);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class BoardContext implements Context {
|
|||||||
private $storedCards = [];
|
private $storedCards = [];
|
||||||
private $activities = null;
|
private $activities = null;
|
||||||
|
|
||||||
private ServerContext $serverContext;
|
private $serverContext;
|
||||||
|
|
||||||
/** @BeforeScenario */
|
/** @BeforeScenario */
|
||||||
public function gatherContexts(BeforeScenarioScope $scope) {
|
public function gatherContexts(BeforeScenarioScope $scope) {
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ class ServerContext implements Context {
|
|||||||
WebDav::__construct as private __tConstruct;
|
WebDav::__construct as private __tConstruct;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string $rawBaseUrl;
|
private $rawBaseUrl;
|
||||||
private string $mappedUserId;
|
private $mappedUserId;
|
||||||
private array $lastInsertIds = [];
|
private $lastInsertIds = [];
|
||||||
|
|
||||||
public function __construct($baseUrl) {
|
public function __construct($baseUrl) {
|
||||||
$this->rawBaseUrl = $baseUrl;
|
$this->rawBaseUrl = $baseUrl;
|
||||||
|
|||||||
Reference in New Issue
Block a user