Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/files/lib/Sharing/Source/NodeShareSourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use OCP\Interaction\InteractionResource;
use OCP\Interaction\Resources\NodeResource;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\L10N\IFactory;

/**
Expand Down Expand Up @@ -72,8 +73,8 @@ public function getSourceIcon(string $source): ShareIconURL {
}

#[\Override]
public function getSourceInteractionResource(string $userId, string $source): InteractionResource {
return new NodeResource((int)$source, $userId);
public function getSourceInteractionResource(IUser $user, string $source): InteractionResource {
return new NodeResource((int)$source, $user->getUID());
}

#[\Override]
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Sharing/SharingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ private function validateInteraction(ShareAccessContext $accessContext, Share $s
$action = new ShareAction(null, array_values(array_map(static fn (SharePermission $permission): string => $permission->class, $share->getEnabledPermissions())));

$usersToCheck = [];
if ($share->owner->instance === null && ($ownerUser = $this->userManager->get($share->owner->userId)) !== null) {
if ($share->owner->instance === null && ($ownerUser = $this->userManager->get($share->owner->userId)) instanceof IUser) {
$usersToCheck[] = $ownerUser;
}

Expand Down Expand Up @@ -733,7 +733,7 @@ private function validateInteraction(ShareAccessContext $accessContext, Share $s
continue;
}

$resources[] = $sourceType->getSourceInteractionResource($userToCheck->getUID(), $source->value);
$resources[] = $sourceType->getSourceInteractionResource($userToCheck, $source->value);
}

$event = new RestrictInteractionEvent($userToCheck->getUID(), $userToCheck, $resources, $action, $receivers);
Expand Down
4 changes: 2 additions & 2 deletions lib/unstable/Sharing/Source/IShareSourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use NCU\Sharing\Icon\ShareIconURL;
use OCP\AppFramework\Attribute\Implementable;
use OCP\Interaction\InteractionResource;
use OCP\IUser;
use OCP\L10N\IFactory;

/**
Expand Down Expand Up @@ -52,9 +53,8 @@ public function getSourceDisplayName(string $source): ?string;
public function getSourceIcon(string $source): null|ShareIconSVG|ShareIconURL;

/**
* @param non-empty-string $userId
* @param non-empty-string $source
* @experimental 35.0.0
*/
public function getSourceInteractionResource(string $userId, string $source): InteractionResource;
public function getSourceInteractionResource(IUser $user, string $source): InteractionResource;
}
3 changes: 2 additions & 1 deletion tests/lib/Sharing/TestShareSourceType1.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use NCU\Sharing\Icon\ShareIconURL;
use NCU\Sharing\Source\IShareSourceType;
use OCP\Interaction\InteractionResource;
use OCP\IUser;
use OCP\L10N\IFactory;

class TestShareSourceType1 implements IShareSourceType {
Expand Down Expand Up @@ -45,7 +46,7 @@ public function getSourceIcon(string $source): null|ShareIconSVG|ShareIconURL {
}

#[\Override]
public function getSourceInteractionResource(string $userId, string $source): InteractionResource {
public function getSourceInteractionResource(IUser $user, string $source): InteractionResource {
return new TestInteractionResource($source);
}
}
Loading