You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -56,37 +60,41 @@ public function handle(Event $event): void {
56
60
thrownewInteractionRestrictedException('Cannot share home folder node.', $this->l10n->t('You cannot share your home folder.'));
57
61
}
58
62
59
-
if ($event->action->filesSharingPermissions !== null) {
60
-
if ($resource->getNode() instanceof File) {
61
-
if (($event->action->filesSharingPermissions & Constants::PERMISSION_DELETE) === Constants::PERMISSION_DELETE) {
62
-
thrownewInteractionRestrictedException('Cannot share file node with delete permission.', $this->l10n->t('File cannot be shared with delete permission.'));
63
-
}
64
-
65
-
if (($event->action->filesSharingPermissions & Constants::PERMISSION_CREATE) === Constants::PERMISSION_CREATE) {
66
-
thrownewInteractionRestrictedException('Cannot share file node with create permission.', $this->l10n->t('File cannot be shared with create permission.'));
67
-
}
63
+
// These checks are only for files_sharing, because they operate on shares that can only contain a single source.
64
+
// With Unified Sharing, there could be multiple sources like a file and a folder in the same share. Because it grants permission on a share and not a single node, this check doesn't work.
65
+
if ($event->action->filesSharingPermissions !== null && $resource->getNode() instanceof File) {
66
+
if (($event->action->filesSharingPermissions & Constants::PERMISSION_DELETE) === Constants::PERMISSION_DELETE) {
67
+
thrownewInteractionRestrictedException('Cannot share file node with delete permission.', $this->l10n->t('File cannot be shared with delete permission.'));
thrownewInteractionRestrictedException('No read permission on the share.', $this->l10n->t('File share needs at least read permission.'));
75
-
}
70
+
if (($event->action->filesSharingPermissions & Constants::PERMISSION_CREATE) === Constants::PERMISSION_CREATE) {
71
+
thrownewInteractionRestrictedException('Cannot share file node with create permission.', $this->l10n->t('File cannot be shared with create permission.'));
72
+
}
73
+
}
76
74
77
-
if (($receiverinstanceof LinkReceiver || $receiverinstanceof EmailReceiver)
thrownewInteractionRestrictedException('Cannot share node with more permissions than the node already has.', $this->l10n->t('You cannot share "%s" with more permission than you have yourself.', [$path]));
83
+
if (($receiverinstanceof LinkReceiver || $receiverinstanceof EmailReceiver)
thrownewInteractionRestrictedException('Cannot share node with more permissions than the node already has.', $this->l10n->t('You cannot share "%s" with more permission than you have yourself.', [$path]));
0 commit comments