Skip to content

Commit 3e26e70

Browse files
fracadoelzody
authored andcommitted
IONOS: fix: for shares allow document creation only for users that can edit
Signed-off-by: Franziska Bath <franziska.bath@strato.de>
1 parent 5b5cab2 commit 3e26e70

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/public.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
isDocument,
66
isDownloadHidden,
77
} from './helpers/index.js'
8+
import { getCurrentUser } from '@nextcloud/auth'
89
import NewFileMenu from './view/NewFileMenu.js'
910

1011
const optionalMimetypes = getCapabilities().richdocuments.mimetypesNoDefaultOpen
@@ -14,7 +15,12 @@ document.addEventListener('DOMContentLoaded', () => {
1415
return
1516
}
1617

17-
if (OCA.Files && OCA.Files.fileActions) {
18+
const userGroups = getCurrentUser()?.groups || []
19+
const editGroups = getCapabilities().richdocuments.config.edit_groups || []
20+
const editGroupsArray = Array.isArray(editGroups) ? editGroups : [editGroups]
21+
const userInEditGroups = editGroupsArray.some(group => userGroups.includes(group))
22+
23+
if (OCA.Files && OCA.Files.fileActions && userInEditGroups) {
1824
OC.Plugins.register('OCA.Files.NewFileMenu', NewFileMenu)
1925
}
2026

0 commit comments

Comments
 (0)