diff --git a/composer.json b/composer.json
index 6d038c8..1f8b2c5 100644
--- a/composer.json
+++ b/composer.json
@@ -7,6 +7,7 @@
"php": ">=8.4",
"ext-ctype": "*",
"ext-iconv": "*",
+ "ext-soap": "*",
"api-platform/doctrine-orm": "^4.2",
"api-platform/symfony": "^4.2",
"doctrine/doctrine-bundle": "^3.2",
diff --git a/composer.lock b/composer.lock
index fe5dd20..7ca3471 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "9c04091eea0e10c19713a1d882b04f91",
+ "content-hash": "9a85291a52081179f427fa0c2b60d061",
"packages": [
{
"name": "api-platform/doctrine-common",
@@ -11664,7 +11664,8 @@
"platform": {
"php": ">=8.4",
"ext-ctype": "*",
- "ext-iconv": "*"
+ "ext-iconv": "*",
+ "ext-soap": "*"
},
"platform-dev": {},
"plugin-api-version": "2.9.0"
diff --git a/frontend/components/workflow/workflow-waiting-list.vue b/frontend/components/workflow/workflow-waiting-list.vue
index 75fb8d8..c0ffa54 100644
--- a/frontend/components/workflow/workflow-waiting-list.vue
+++ b/frontend/components/workflow/workflow-waiting-list.vue
@@ -18,7 +18,8 @@
(), {
- showActions: false
+ showActions: false,
+ canOpenItems: true
})
const router = useRouter()
@@ -62,6 +65,9 @@ const gridCols = computed(() => {
})
const goToItem = (id: number) => {
+ if (!props.canOpenItems) {
+ return
+ }
router.push(`${props.routePrefix}/${id}`)
}
diff --git a/frontend/middleware/auth.global.ts b/frontend/middleware/auth.global.ts
index 1dbd6fb..07f4b9d 100644
--- a/frontend/middleware/auth.global.ts
+++ b/frontend/middleware/auth.global.ts
@@ -2,6 +2,13 @@ import { useAuthStore } from '~/stores/auth'
export default defineNuxtRouteMiddleware(async (to) => {
const auth = useAuthStore()
+ const guestAllowedPaths = [
+ '/',
+ '/reception/waiting-reception',
+ '/reception/finish-reception',
+ '/shipment/waiting-shipment',
+ '/shipment/finish-shipment'
+ ]
if (to.path === '/login') {
return
@@ -14,4 +21,8 @@ export default defineNuxtRouteMiddleware(async (to) => {
if (!auth.isAuthenticated) {
return navigateTo('/login')
}
+
+ if (auth.isGuest && !guestAllowedPaths.includes(to.path)) {
+ return navigateTo('/')
+ }
})
diff --git a/frontend/pages/admin/user/[[id]].vue b/frontend/pages/admin/user/[[id]].vue
index 6c27542..5f146a9 100644
--- a/frontend/pages/admin/user/[[id]].vue
+++ b/frontend/pages/admin/user/[[id]].vue
@@ -96,8 +96,7 @@ const hydrateFromUser = (user: UserData | null) => {
isHydrating.value = true
form.username = user.username ?? ''
const roles = user.roles ?? []
- const hasAdmin = roles.includes('ROLE_ADMIN')
- form.role = hasAdmin ? 'ROLE_ADMIN' : 'ROLE_USER'
+ form.role = ROLE.find((role) => roles.includes(role.value))?.value ?? 'ROLE_USER'
form.password = ''
isHydrating.value = false
}
diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue
index 8eb2e9a..402ad85 100644
--- a/frontend/pages/index.vue
+++ b/frontend/pages/index.vue
@@ -1,10 +1,13 @@
-
-
-
+
+
+
Réceptions
EN ATTENTE
@@ -15,10 +18,10 @@
EXPÉDITIONS
EN ATTENTE
-
+
-
+
PASSEPORT
DU BOVIN
diff --git a/frontend/pages/reception/finish-reception.vue b/frontend/pages/reception/finish-reception.vue
index abf79a0..91a76bf 100644
--- a/frontend/pages/reception/finish-reception.vue
+++ b/frontend/pages/reception/finish-reception.vue
@@ -17,7 +17,8 @@
import type {ReceptionData} from "~/services/dto/reception-data";
import {getReceptionList} from "~/services/reception";
-import type {ShipmentData} from "~/services/dto/shipment-data";
+import { useAuthStore } from '~/stores/auth'
const receptionList = ref()
const router = useRouter()
+const auth = useAuthStore()
const formatDate = (date: string | null) => {
if (!date) return '—'
@@ -66,6 +68,7 @@ const formatWeighing = (reception: ReceptionData) => {
}
const goToReception = (id: number) => {
+ if (!auth.canUseWorkflow) return
router.push(`/reception/update/${id}`)
}
diff --git a/frontend/pages/reception/waiting-reception.vue b/frontend/pages/reception/waiting-reception.vue
index 11125bc..7428a5a 100644
--- a/frontend/pages/reception/waiting-reception.vue
+++ b/frontend/pages/reception/waiting-reception.vue
@@ -4,7 +4,8 @@
:columns="columns"
:items="receptionList ?? []"
route-prefix="/reception"
- show-actions
+ :show-actions="auth.canUseWorkflow"
+ :can-open-items="auth.canUseWorkflow"
>
{{ formatDate(item.receptionDate) }}
@@ -23,6 +24,9 @@