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

[cern] feat: restrict copy action above space root #9805

Merged
merged 1 commit into from
Oct 16, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const useFileActionsCopy = ({ store }: { store?: Store<any> } = {}) => {
return window.navigator.platform.match('Mac')
})

const runningOnEos = computed<boolean>(() => store.getters.configuration?.options?.runningOnEos)

const copyShortcutString = computed(() => {
if (unref(isMacOs)) {
return $pgettext('Keyboard shortcut for macOS for copying files', '⌘ + C')
Expand Down Expand Up @@ -74,6 +76,14 @@ export const useFileActionsCopy = ({ store }: { store?: Store<any> } = {}) => {
return false
}

if (unref(runningOnEos)) {
// CERNBox does not allow actions above home/project root
const elems = resources[0].path?.split('/').filter(Boolean) || [] //"/eos/project/c/cernbox"
if (isLocationSpacesActive(router, 'files-spaces-generic') && elems.length < 5) {
return false
}
}

// copy can't be restricted in authenticated context, because
// a user always has their home dir with write access
return true
Expand Down