Skip to content

Commit

Permalink
feat: ✨ introduce fine grained perms and and roles
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudTA committed Jul 26, 2024
1 parent 70945f7 commit b67723e
Show file tree
Hide file tree
Showing 133 changed files with 3,967 additions and 4,461 deletions.
150 changes: 0 additions & 150 deletions apps/client/cypress/components/specs/permission-form.ct.ts

This file was deleted.

7 changes: 7 additions & 0 deletions apps/client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { apiPrefix } from '@cpn-console/shared'
import { getKeycloak } from './utils/keycloak/keycloak.js'
import { useUserStore } from './stores/user.js'
import { useSnackbarStore } from './stores/snackbar.js'
import router from './router/index.js'
const keycloak = getKeycloak()
const userStore = useUserStore()
Expand Down Expand Up @@ -44,6 +45,12 @@ watch(label, (label: string) => {
quickLinks.value[0].label = label
})
userStore.$subscribe(() => {
if (router.currentRoute.value.fullPath.startsWith('/admin') && userStore.adminPerms === 0n) {
window.location.pathname = '/'
}
})
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/api/xhr-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const extractData = <T extends { status: number; body: unknown; headers:
): Extract<T, { status: S }>['body'] => {
if (response.status >= 400 && response.status <= 599) {
// @ts-ignore
throw Error(response.body?.error ?? 'Erreur inconnue')
throw Error(response.body?.error ?? response.body?.message ?? 'Erreur inconnue')
}
if (response.status === expectedStatus) return response.body
try {
Expand Down
Loading

0 comments on commit b67723e

Please sign in to comment.