Skip to content
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
uses: actions/checkout@v4.2.2
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
ref: 'feature/54562/files-sharing-authoritative'
submodules: true

- name: Checkout app
Expand Down
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/Controller/CardApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public function create($title, $type = 'plain', $order = 999, $description = '',
$card = $this->cardService->create($title, $this->request->getParam('stackId'), $type, $order, $this->userId, $description, $duedate);

foreach ($labels as $labelId) {
$this->cardService->assignLabel($card->id, $labelId);
$this->cardService->assignLabel($card->getId(), $labelId);
}

foreach ($users as $user) {
$this->assignmentService->assignUser($card->id, $user['id'], $user['type']);
$this->assignmentService->assignUser($card->getId(), $user['id'], $user['type']);
}

return new DataResponse($card, HTTP::STATUS_OK);
Expand Down
1 change: 0 additions & 1 deletion lib/Db/Assignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use JsonSerializable;

class Assignment extends RelationalEntity implements JsonSerializable {
public $id;
protected $participant;
protected $cardId;
protected $type;
Expand Down
1 change: 0 additions & 1 deletion lib/Db/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use OCP\AppFramework\Db\Entity;

class Session extends Entity implements \JsonSerializable {
public $id;
protected $userId;
protected $token;
protected $lastContact;
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/FilesAppService.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public function markAsDeleted(Attachment $attachment) {
*/
private function getShareForAttachment(Attachment $attachment): IShare {
try {
$share = $this->shareProvider->getShareById($attachment->getId());
$share = $this->shareProvider->getShareById((string)$attachment->getId());
} catch (ShareNotFound $e) {
throw new NoPermissionException('No permission to access the attachment from the card');
}
Expand Down
42 changes: 40 additions & 2 deletions lib/Sharing/DeckShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\Share\Exceptions\GenericShareException;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
use OCP\Share\IPartialShareProvider;
use OCP\Share\IShare;

/** Taken from the talk shareapicontroller helper */
Expand All @@ -42,7 +43,7 @@
public function canAccessShare(IShare $share, string $user): bool;
}

class DeckShareProvider implements \OCP\Share\IShareProvider {
class DeckShareProvider implements \OCP\Share\IShareProvider, IPartialShareProvider {
public const DECK_FOLDER = '/Deck';
public const DECK_FOLDER_PLACEHOLDER = '/{DECK_PLACEHOLDER}';

Expand Down Expand Up @@ -419,7 +420,7 @@

$qb->executeStatement();

return $this->getShareById((int)$share->getId(), $recipient);
return $this->getShareById((string)$share->getId(), $recipient);
}

/**
Expand Down Expand Up @@ -702,6 +703,32 @@
* @return IShare[]
*/
public function getSharedWith($userId, $shareType, $node, $limit, $offset): array {
return $this->_getSharedWith($userId, $limit, $offset, $node);
}

public function getSharedWithByPath(
string $userId,
int $shareType,
string $path,
bool $forChildren,
int $limit,
int $offset,
): iterable {

Check failure on line 716 in lib/Sharing/DeckShareProvider.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

InvalidReturnType

lib/Sharing/DeckShareProvider.php:716:5: InvalidReturnType: The declared return type 'iterable<mixed, OCP\Share\IShare>' for OCA\Deck\Sharing\DeckShareProvider::getSharedWithByPath is incorrect, got 'array<array-key, mixed>' (see https://psalm.dev/011)
return $this->_getSharedWith($userId, $limit, $offset, null, $path, $forChildren);

Check failure on line 717 in lib/Sharing/DeckShareProvider.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

InvalidReturnStatement

lib/Sharing/DeckShareProvider.php:717:10: InvalidReturnStatement: The inferred type 'array<array-key, mixed>' does not match the declared return type 'iterable<mixed, OCP\Share\IShare>' for OCA\Deck\Sharing\DeckShareProvider::getSharedWithByPath (see https://psalm.dev/128)
}

/**
* Get received shared for the given user.
* You can optionally provide a node or a path to filter the shares.
*/
public function _getSharedWith(
string $userId,
int $limit,
int $offset,
?Node $node = null,
?string $path = null,
?bool $forChildren = false,
): array {
$allBoards = $this->boardMapper->findBoardIds($userId);

/** @var IShare[] $shares */
Expand Down Expand Up @@ -740,6 +767,17 @@
$qb->andWhere($qb->expr()->eq('s.file_source', $qb->createNamedParameter($node->getId())));
}

if ($path !== null) {
$qb->leftJoin('s', 'share', 'sc', $qb->expr()->eq('s.parent', 'sc.id'))
->andWhere($qb->expr()->eq('sc.share_type', $qb->createNamedParameter(IShare::TYPE_DECK_USER)));

if ($forChildren) {
$qb->andWhere($qb->expr()->like('sc.file_target', $qb->createNamedParameter($this->dbConnection->escapeLikeParameter($path) . '_%')));
} else {
$qb->andWhere($qb->expr()->eq('sc.file_target', $qb->createNamedParameter($path)));
}
}

$qb->andWhere($qb->expr()->eq('s.share_type', $qb->createNamedParameter(IShare::TYPE_DECK)))
->andWhere($qb->expr()->in('db.id', $qb->createNamedParameter(
$boards,
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ HIDE_OC_LOGS=$2

# Nextcloud integration tests composer
(
cd ${OC_PATH}build/integration
composer install
composer --working-dir $OC_PATH install
)
INSTALLED=$($OCC status | grep installed: | cut -d " " -f 5)

Expand Down
Loading