Skip to content

Commit 218b4d4

Browse files
rodcoffanidiocas
authored andcommitted
lightweight-accounts: filter access to home page
1 parent e450829 commit 218b4d4

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

lightweight-accounts/src/extensions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { computed } from 'vue'
22
import { useGettext } from 'vue3-gettext'
33
import {
4-
ApplicationSetupOptions,
5-
SidebarNavExtension,
6-
useUserStore,
7-
useSpacesStore
4+
ApplicationSetupOptions,
5+
SidebarNavExtension,
6+
useUserStore,
7+
useSpacesStore
88
} from '@ownclouders/web-pkg'
99
import { isPersonalSpaceResource } from '@ownclouders/web-client'
1010

lightweight-accounts/src/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { useGettext } from 'vue3-gettext'
2-
import {
3-
defineWebApplication,
4-
useRouter,
5-
useUserStore,
6-
useSpacesStore
7-
} from '@ownclouders/web-pkg'
2+
import { defineWebApplication, useRouter, useUserStore, useSpacesStore } from '@ownclouders/web-pkg'
83
import { watch } from 'vue'
94
import { isPersonalSpaceResource } from '@ownclouders/web-client'
105
import translations from '../l10n/translations.json'
@@ -25,7 +20,13 @@ export default defineWebApplication({
2520
meta: { entryPoint: true, authContext: 'user' },
2621
beforeEnter: (to, from, next) => {
2722
if (spacesStore.spacesInitialized) {
28-
next()
23+
const userHasPersonalSpace = !!spacesStore.spaces.find(
24+
(drive) => isPersonalSpaceResource(drive) && drive.isOwner(userStore.user)
25+
)
26+
if (!userHasPersonalSpace) {
27+
next()
28+
}
29+
next({ path: '/files' })
2930
}
3031
watch(
3132
() => spacesStore.spacesInitialized,

0 commit comments

Comments
 (0)