Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable21] Only allow removing existing shares that would not be allowed due to reshare restrictions #27551

Merged
merged 4 commits into from
Jun 29, 2021
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
2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/files_sharing_tab.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions apps/files_sharing/lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace OCA\Files_Sharing;

use OCP\Constants;
use OCP\Share\IShare;

class Updater {
Expand Down Expand Up @@ -82,7 +83,12 @@ private static function moveShareToShare($path) {
//Ownership is moved over
foreach ($shares as $share) {
/** @var IShare $share */
if (!($dstMount->getShare()->getPermissions() & Constants::PERMISSION_SHARE)) {
$shareManager->deleteShare($share);
continue;
}
$share->setShareOwner($newOwner);
$share->setPermissions($share->getPermissions() & $dstMount->getShare()->getPermissions());
$shareManager->updateShare($share);
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
:open.sync="open"
@close="onMenuClose">
<template v-if="share">
<template v-if="share.canEdit">
<template v-if="share.canEdit && canReshare">
<!-- Custom Label -->
<ActionInput
ref="label"
Expand Down
20 changes: 16 additions & 4 deletions tests/acceptance/features/bootstrap/FilesAppSharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ public static function shareLinkMenuTrigger() {
describedAs("Share link menu trigger in the details view in Files app");
}

/**
* @return Locator
*/
public static function shareLinkSingleUnshareAction() {
return Locator::forThe()->css(".sharing-entry__actions.icon-close")->
descendantOf(self::shareLinkRow())->
describedAs("Unshare link single action in the details view in Files app");
}

/**
* @return Locator
*/
Expand Down Expand Up @@ -503,10 +512,13 @@ public function iUnshareTheFileWith($shareWithName) {
* @When I unshare the link share
*/
public function iUnshareTheLink() {
$this->showShareLinkMenuIfNeeded();

$shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 2);
$this->actor->find(self::unshareLinkButton($shareLinkMenuTriggerElement), 2)->click();
try {
$this->actor->find(self::shareLinkSingleUnshareAction(), 2)->click();
} catch (NoSuchElementException $e) {
$this->showShareLinkMenuIfNeeded();
$shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 2);
$this->actor->find(self::unshareLinkButton($shareLinkMenuTriggerElement), 2)->click();
}
}

/**
Expand Down