Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2f55914
Accept OCM to groups
michielbdejong Apr 18, 2023
5eeb437
Accept OCM to groups
michielbdejong Apr 18, 2023
0485d0f
fix the broken tests
navid-shokri Apr 20, 2023
c2d3c6b
Fix code style
phil-davis Apr 21, 2023
783fe0c
Update ProviderFactory.php
navid-shokri Jun 26, 2023
049b9a8
Merge pull request #16 from pondersource/Fix#19-ocm
navid-shokri Jun 27, 2023
53b2921
improve logics
shokri-navid Jul 14, 2023
36b625d
adjust code format
shokri-navid Jul 14, 2023
263ceaa
remove extra space
shokri-navid Jul 14, 2023
2bea3c6
remove extra space
shokri-navid Jul 14, 2023
98d1200
Merge pull request #17 from pondersource/fix/review-comments
navid-shokri Jul 14, 2023
ab60172
add logger to RemoteOcsController
shokri-navid Jul 14, 2023
9f59310
resolve RemotOcsControllerTest error
shokri-navid Jul 14, 2023
7331f71
Resolve PR review conversations
shokri-navid Jul 14, 2023
d1d9d5e
Merge remote-tracking branch 'refs/remotes/origin/accept-ocm-to-group…
shokri-navid Jul 14, 2023
2d51f5d
check if shareType is undefined
soltanireza65 Jul 14, 2023
05f14c1
add comment to apps/files_sharing/api/v1 body `shareType`
soltanireza65 Jul 14, 2023
169637c
convert string share type to int
shokri-navid Jul 15, 2023
b2bc981
improve logics
shokri-navid Jul 14, 2023
85bb598
remove extra space
shokri-navid Jul 14, 2023
6ee6aa1
code style fix
shokri-navid Jul 16, 2023
e0fabef
add missing logger parameter in RemoteOcsController
shokri-navid Jul 16, 2023
78fbce0
Merge branch 'master' into accept-to-ocm-group-2
navid-shokri Jul 21, 2023
4964faa
throw share not found exception on wrong share link
shokri-navid Jul 27, 2023
3a99fac
Rename group manager to avoid confusion
MahdiBaghbani Aug 10, 2023
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
6 changes: 4 additions & 2 deletions apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public function testGetProperties($shareTypes) {
\OCP\Share::SHARE_TYPE_USER,
\OCP\Share::SHARE_TYPE_GROUP,
\OCP\Share::SHARE_TYPE_LINK,
\OCP\Share::SHARE_TYPE_REMOTE
\OCP\Share::SHARE_TYPE_REMOTE,
\OCP\Share::SHARE_TYPE_REMOTE_GROUP
];

$this->shareManager->expects($this->any())
Expand Down Expand Up @@ -172,7 +173,8 @@ public function testPreloadThenGetProperties($shareTypes) {
\OCP\Share::SHARE_TYPE_USER,
\OCP\Share::SHARE_TYPE_GROUP,
\OCP\Share::SHARE_TYPE_LINK,
\OCP\Share::SHARE_TYPE_REMOTE
\OCP\Share::SHARE_TYPE_REMOTE,
\OCP\Share::SHARE_TYPE_REMOTE_GROUP
];

$this->shareManager->expects($this->any())
Expand Down
4 changes: 2 additions & 2 deletions apps/federatedfilesharing/lib/Controller/OcmController.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function createShare(
// Allow other apps to overwrite the behaviour of this endpoint
if ($shareType === 'group') {
$controllerClass = $this->config->getSystemValue('sharing.ocmController');
if ($controllerClass !== '') {
if (!empty($controllerClass)) {
$controller = \OC::$server->query($controllerClass);
return $controller->createShare(...\func_get_args());
}
Expand Down Expand Up @@ -304,7 +304,7 @@ public function processNotification(
) {
// Allow other apps to overwrite the behaviour of this endpoint
$controllerClass = $this->config->getSystemValue('sharing.ocmController');
if ($controllerClass !== '') {
if (!empty($controllerClass)) {
$controller = \OC::$server->query($controllerClass);
return $controller->processNotification(...\func_get_args());
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/Controller/RemoteOcsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function getShares($includingPending = false) {

// Allow the Federated Groups app to overwrite the behaviour of this endpoint
$managerClass = $this->config->getSystemValue('sharing.groupExternalManager');
if ($managerClass !== '') {
if (!empty($managerClass)) {
$groupExternalManager = \OC::$server->query($managerClass);

foreach ($groupExternalManager->getAcceptedShares() as $shareInfo) {
Expand Down
4 changes: 4 additions & 0 deletions apps/files_sharing/lib/Controller/Share20OcsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,10 @@ private function getShareById($id, $recipient = null) {
}
}

if ($share === null) {
throw new ShareNotFound();
}

return $share;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public function testGetShare($getShareResult, $expectedStatusCode) {
$this->appName,
$this->request,
$this->externalManager,
$this->config,
'user'
])
->setMethods(['getFileInfo'])
Expand Down
14 changes: 14 additions & 0 deletions apps/files_sharing/tests/Controller/Share20OcsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ protected function setUp(): void {
->expects($this->any())
->method('newShare')
->willReturn($this->newShare());
$this->shareManager
->method('getProvidersCapabilities')
->willReturn([
"ocinternal" =>
[
"user" => ["shareExpiration"],
"group" => ["shareExpiration"],
"link" => ["shareExpiration", "passwordProtected"]
],
"ocFederatedSharing"=>
[
"remote" => ["shareExpiration"]
],
]);
$this->groupManager = $this->createMock(IGroupManager::class);
$this->userManager = $this->createMock(IUserManager::class);
$this->request = $this->createMock(IRequest::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function testCreate() {
$called[] = 'remoteshare.accepted';
\array_push($called, $event);
});
$this->assertEquals(new JSONResponse(), $this->getExternalShareController()->create($shareId));
$this->assertEquals(new JSONResponse(), $this->getExternalShareController()->create($shareId, "user"));

$this->assertSame('remoteshare.accepted', $called[0]);
$this->assertInstanceOf(GenericEvent::class, $called[1]);
Expand Down Expand Up @@ -138,7 +138,7 @@ public function testDestroy() {
\array_push($called, $event);
});

$this->assertEquals(new JSONResponse(), $this->getExternalShareController()->destroy($shareId));
$this->assertEquals(new JSONResponse(), $this->getExternalShareController()->destroy($shareId, "user"));

$this->assertSame('remoteshare.declined', $called[0]);
$this->assertInstanceOf(GenericEvent::class, $called[1]);
Expand Down