Merge pull request #27551 from nextcloud/backport/26571/stable21

[stable21] Only allow removing existing shares that would not be allowed due to reshare restrictions
pull/27711/head
blizzz 2021-06-29 23:38:53 +07:00 committed by GitHub
commit 3ceb76ecf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -27,6 +27,7 @@
namespace OCA\Files_Sharing;
use OCP\Constants;
use OCP\Share\IShare;
class Updater {
@ -82,7 +83,12 @@ class Updater {
//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);
}
}

@ -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"

@ -218,6 +218,15 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
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
*/
@ -503,10 +512,13 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
* @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();
}
}
/**