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

[stable24] Add share attributes + prevent download permission #33416

Merged
merged 15 commits into from
Aug 4, 2022

Conversation

backportbot-nextcloud[bot]
Copy link

@backportbot-nextcloud backportbot-nextcloud bot commented Aug 1, 2022

backport of #32482

@backportbot-nextcloud backportbot-nextcloud bot added this to the Nextcloud 24.0.4 milestone Aug 1, 2022
apps/dav/lib/Server.php Fixed Show fixed Hide fixed
lib/private/legacy/OC_Files.php Fixed Show fixed Hide fixed
@@ -99,6 +107,13 @@
throw new OCSBadRequestException('Direct download only works for files');
}

$event = new BeforeDirectFileDownloadEvent($userFolder->getRelativePath($file->getPath()));

Check notice

Code scanning / Psalm

PossiblyNullArgument

Argument 1 of OCP\Files\Events\BeforeDirectFileDownloadEvent::__construct cannot be null, possibly null value provided
if (count($nodes) > 0) {
$node = $nodes[0];
$storage = $node->getStorage();
if ($storage && $storage->instanceOfStorage(SharedStorage::class)) {

Check notice

Code scanning / Psalm

RedundantConditionGivenDocblockType

Docblock-defined type OCP\Files\Storage\IStorage for $storage is never falsy
@CarlSchwan CarlSchwan force-pushed the backport/32482/stable24 branch from 59c17bc to acb4550 Compare August 1, 2022 11:02
@blizzz blizzz mentioned this pull request Aug 1, 2022
@PVince81 PVince81 added the 2. developing Work in progress label Aug 1, 2022
@PVince81
Copy link
Member

PVince81 commented Aug 2, 2022

@CarlSchwan can you take care of the conflicts ?

PVince81 and others added 14 commits August 3, 2022 13:24
Makes it possible to store download permission

Signed-off-by: Vincent Petry <[email protected]>
When not specified in the OCS call, don't reset the share attributes.

Signed-off-by: Vincent Petry <[email protected]>
Added download permission checkbox in frontend
Added share attributes parsing and setting in frontend.

Signed-off-by: Vincent Petry <[email protected]>
When resharing by link, if the download permission was removed through
share attributes, convert it to the hide download flag.

Signed-off-by: Vincent Petry <[email protected]>
- Fix tests
- Use non deprecated event stuff
- Add a bit of type hinting to the new stuff
- More safe handling of instanceOfStorage (share might not be the first
  wrapper)
- Fix resharing

Signed-off-by: Carl Schwan <[email protected]>
@CarlSchwan CarlSchwan force-pushed the backport/32482/stable24 branch from 483b389 to 13886b1 Compare August 3, 2022 11:28
Signed-off-by: Carl Schwan <[email protected]>
@CarlSchwan CarlSchwan force-pushed the backport/32482/stable24 branch from 13886b1 to 843b54e Compare August 3, 2022 14:10
@CarlSchwan CarlSchwan requested review from a team, PVince81 and icewind1991 and removed request for a team August 3, 2022 15:49
@CarlSchwan CarlSchwan requested a review from juliusknorr August 3, 2022 15:49
Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

I only reviewed starting at the commit "Multiple fixes" as it seems to be post-backport. Let me know if there's more

Can you confirm that the scenarios you needed to fix (ex: before zip download) still work ?

@CarlSchwan CarlSchwan added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 4, 2022
@CarlSchwan
Copy link
Member

See comments

I only reviewed starting at the commit "Multiple fixes" as it seems to be post-backport. Let me know if there's more

Can you confirm that the scenarios you needed to fix (ex: before zip download) still work ?

I tested a few things and that still works

Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@PVince81 PVince81 merged commit d26c098 into stable24 Aug 4, 2022
@PVince81 PVince81 deleted the backport/32482/stable24 branch August 4, 2022 08:48
@PVince81
Copy link
Member

PVince81 commented Aug 4, 2022

@juliushaertl backport is merged, you can update/merge the office counterparts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants