Skip to content

Commit 53b1650

Browse files
authored
Merge pull request #54557 from nextcloud/backport/54410/stable29
2 parents 898facd + a28aa4e commit 53b1650

10 files changed

+44
-13
lines changed

apps/files_sharing/src/actions/sharingStatusAction.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { getCurrentUser } from '@nextcloud/auth'
3333
import { generateAvatarSvg } from '../utils/AccountIcon.ts'
3434

3535
import './sharingStatusAction.scss'
36+
import { showError } from '@nextcloud/dialogs'
3637

3738
const isExternal = (node: Node) => {
3839
return node.attributes.remote_id !== undefined
@@ -135,15 +136,23 @@ export const action = new FileAction({
135136
return true
136137
}
137138

139+
// You need share permissions to share this file
140+
// and read permissions to see the sidebar
138141
return (node.permissions & Permission.SHARE) !== 0
142+
&& (node.permissions & Permission.READ) !== 0
139143
},
140144

141145
async exec(node: Node, view: View, dir: string) {
142146
// You need read permissions to see the sidebar
143147
if ((node.permissions & Permission.READ) !== 0) {
144148
window.OCA?.Files?.Sidebar?.setActiveTab?.('sharing')
145-
return sidebarAction.exec(node, view, dir)
149+
sidebarAction.exec(node, view, dir)
150+
return null
146151
}
152+
153+
// Should not happen as the enabled check should prevent this
154+
// leaving it here for safety or in case someone calls this action directly
155+
showError(t('files_sharing', 'You do not have enough permissions to share this file.'))
147156
return null
148157
},
149158

dist/core-common.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/federatedfilesharing-vue-settings-admin.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/federatedfilesharing-vue-settings-admin.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-init.js.LICENSE.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,25 @@
4242
* along with this program. If not, see <http://www.gnu.org/licenses/>.
4343
*
4444
*/
45+
46+
/**
47+
* @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
48+
*
49+
* @author John Molakvoæ <[email protected]>
50+
*
51+
* @license AGPL-3.0-or-later
52+
*
53+
* This program is free software: you can redistribute it and/or modify
54+
* it under the terms of the GNU Affero General Public License as
55+
* published by the Free Software Foundation, either version 3 of the
56+
* License, or (at your option) any later version.
57+
*
58+
* This program is distributed in the hope that it will be useful,
59+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
60+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
61+
* GNU Affero General Public License for more details.
62+
*
63+
* You should have received a copy of the GNU Affero General Public License
64+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
65+
*
66+
*/

dist/files_sharing-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-vue-settings-admin-delegation.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-vue-settings-admin-delegation.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)