Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54354c4435 | ||
| 3dcdf0fb81 |
6
.idea/data_source_mapping.xml
generated
6
.idea/data_source_mapping.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="DataSourcePerFileMappings">
|
|
||||||
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/9cad43df-2147-4989-b7a4-443067034884/console_3.sql" value="9cad43df-2147-4989-b7a4-443067034884" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -17,3 +17,8 @@ Remplie la base avec le dump :
|
|||||||
```shell
|
```shell
|
||||||
docker compose exec -T db psql -U root -d sirh < sirh.sql
|
docker compose exec -T db psql -U root -d sirh < sirh.sql
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Mettre SUPER_ADMIN sur un user
|
||||||
|
```sql
|
||||||
|
UPDATE users SET roles = '["ROLE_ADMIN","ROLE_SUPER_ADMIN"]' WHERE username = 'emilie';
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
parameters:
|
parameters:
|
||||||
app.version: '0.1.66'
|
app.version: '0.1.67'
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
|
v-if="isAdmin || !isDriver"
|
||||||
to="/hours"
|
to="/hours"
|
||||||
class="flex items-center gap-2 py-2 text-md text-black hover:bg-tertiary-500 hover:text-primary-500"
|
class="flex items-center gap-2 py-2 text-md text-black hover:bg-tertiary-500 hover:text-primary-500"
|
||||||
:class="[
|
:class="[
|
||||||
@@ -30,12 +31,13 @@
|
|||||||
<p>Heures</p>
|
<p>Heures</p>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-if="isAdmin"
|
v-if="isAdmin || isDriver"
|
||||||
to="/driver-hours"
|
to="/driver-hours"
|
||||||
class="flex items-center gap-2 py-2 text-md text-black hover:bg-tertiary-500 hover:text-primary-500"
|
class="flex items-center gap-2 py-2 text-md text-black hover:bg-tertiary-500 hover:text-primary-500"
|
||||||
:class="route.path.startsWith('/driver-hours')
|
:class="[
|
||||||
? 'bg-tertiary-500 text-primary-500 font-bold'
|
route.path.startsWith('/driver-hours') ? 'bg-tertiary-500 text-primary-500 font-bold' : '',
|
||||||
: ''"
|
!isAdmin && isDriver ? 'border-t border-secondary-500 pt-3' : ''
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<Icon name="mdi:truck-outline" size="24"/>
|
<Icon name="mdi:truck-outline" size="24"/>
|
||||||
<p>Heures Conducteurs</p>
|
<p>Heures Conducteurs</p>
|
||||||
@@ -115,5 +117,6 @@ const auth = useAuthStore()
|
|||||||
const {version} = useAppVersion()
|
const {version} = useAppVersion()
|
||||||
const isAdmin = computed(() => auth.user?.roles?.includes('ROLE_ADMIN') ?? false)
|
const isAdmin = computed(() => auth.user?.roles?.includes('ROLE_ADMIN') ?? false)
|
||||||
const isSuperAdmin = computed(() => auth.user?.roles?.includes('ROLE_SUPER_ADMIN') ?? false)
|
const isSuperAdmin = computed(() => auth.user?.roles?.includes('ROLE_SUPER_ADMIN') ?? false)
|
||||||
|
const isDriver = computed(() => auth.user?.isDriver ?? false)
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ const handleSubmit = async () => {
|
|||||||
await auth.login(username.value, password.value)
|
await auth.login(username.value, password.value)
|
||||||
|
|
||||||
const isAdmin = auth.user?.roles?.includes('ROLE_ADMIN')
|
const isAdmin = auth.user?.roles?.includes('ROLE_ADMIN')
|
||||||
await router.push(isAdmin ? '/calendar' : '/hours')
|
const isDriver = auth.user?.isDriver
|
||||||
|
await router.push(isAdmin ? '/calendar' : isDriver ? '/driver-hours' : '/hours')
|
||||||
} finally {
|
} finally {
|
||||||
isSubmitting.value = false
|
isSubmitting.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ export type UserData = {
|
|||||||
id: number
|
id: number
|
||||||
username: string
|
username: string
|
||||||
roles: string[]
|
roles: string[]
|
||||||
|
isDriver: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,5 +224,11 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Groups(['user:read'])]
|
||||||
|
public function getIsDriver(): bool
|
||||||
|
{
|
||||||
|
return $this->employee?->getIsDriver() ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
public function eraseCredentials(): void {}
|
public function eraseCredentials(): void {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user