This can happen in various scenarios, we should allow the user to delete
the share in this situation.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
When creating public links from federated shares, users should be able to set
the 'Hide download' option independently as long as they are more restrictive
than the original share permissions.
Previously, the `checkInheritedAttributes` method was ignoring user preferences
and always overriding the hideDownload setting based solely on inherited
permissions, preventing users from disabling downloads even when the parent
share allowed them.
This fix implements some sort of inheritance logic:
- Users can only be MORE restrictive than parent shares, never LESS restrictive
- If parent hides downloads -> child MUST hide downloads (enforced)
- If parent allows downloads -> child can CHOOSE to hide or allow downloads
- If parent forbids downloads entirely -> child cannot enable downloads
Signed-off-by: nfebe <fenn25.fn@gmail.com>
The password param should never be sent if the intention is not
remove it or update it.
This commit adapts the frontend and backend to this rule to avoid weird bugs
especially around updating new shares.
Signed-off-by: nfebe <fenn25.fn@gmail.com>
[skip ci]
This allows the admin to control the behavior whether link shares with
READ permissions should be extended to also gain SHARE permissions,
allowing users (public share receivers) to add the share to their cloud.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
In this case we do not want the application DI container because we are
requesting classes from other applications, so it’s better to ask the
server container. We use \OCP\Server::get for this.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Remove duplicate activity publishing from share controller download,
listen to BeforeZipCreatedEvent to publish activity for folders, and
cache folders activity to avoid sending activity for each file in the
folder.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
When a user receives a share with share-permissions but also with
download restrictions (hide download or the modern download permission attribute),
then re-shares of that share must always also include those restrictions.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Given:
User creates a link or email share with permissions=4 (create only = file drop).
Problem:
Currently the permissions are automatically extended to permissions = 5
(READ + CREATE). Work around was to create the share and directly update
it.
Solution:
Respect what the user is requesting, create a file drop share.
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Exceptions thrown from password_policy may bubble up in share creation
or update when a password is used. Their message is meant to be shown
to the user. This always the case for HintException so we catch that
instead of the subclass GenericShareException.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Previously there was a different behavior for public shares (link-shares) and internal shares,
if the user disabled the view permission.
The legacy UI for public shares simply "disabled" the context menu and hided all download actions.
With Nextcloud 31 all share types use the consistent permissions attributes,
which simplifies code, but caused a regression: Images can no longer been viewed.
Because on 30 and before the attribute was not set, previews for view-only files
were still allowed. Now with 31 we need a new way to allow "viewing" shares.
So this is allowing previews for those files, but only for internal usage.
This is done by settin a special header, which only works with custom requests,
and not by opening the URL directly.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>