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

[To be disscussed] Disable maps for file drop links #1081

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions lib/Controller/PublicPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ private function validateShare(\OCP\Share\IShare $share) {
return false;
}

//Disable mymaps on file-drop links
$isReadable = ($share->getPermissions() & (1 << 0));
if (!$isReadable) {
return false;
}

return $share->getNode()->isReadable() && $share->getNode()->isShareable();
}

Expand Down
6 changes: 5 additions & 1 deletion lib/Controller/PublicUtilsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ public function getOptionsValues(): DataResponse {
$share = $this->getShare();
$permissions = $share->getPermissions();
$folder = $this->getShareNode();
$isReadable = ($permissions & (1 << 0)) && $folder->isReadable();
if (!$isReadable) {
throw new NotPermittedException();
}
$isCreatable = ($permissions & (1 << 2)) && $folder->isCreatable();
try {
$file=$folder->get(".index.maps");
Expand All @@ -190,7 +194,7 @@ public function getOptionsValues(): DataResponse {
$ov = json_decode($file->getContent(),true, 512);

// Maps content can be read mostly from the folder
$ov['isReadable'] = ($permissions & (1 << 0)) && $folder->isReadable();
$ov['isReadable'] = $isReadable;
//Saving maps information in the file
$ov['isUpdateable'] = ($permissions & (1 << 1)) && $file->isUpdateable();
$ov['isCreatable'] = ($permissions & (1 << 2)) && $folder->isCreatable();
Expand Down
2 changes: 1 addition & 1 deletion src/models/copyMapsLinkAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class CopyMapsLinkAction {
data({ share, fileInfo }) {
this._share = share
return {
is: NcActionButton,
is: share.hasReadPermission ? NcActionButton : null,
ariaLabel: t('maps', 'Copy link to map'),
icon: 'icon-clippy',
title: t('maps', 'Copy link to map'),
Expand Down