Skip to content

Commit e64daeb

Browse files
committed
corbeille
1 parent 9bae4cb commit e64daeb

File tree

8 files changed

+522
-25
lines changed

8 files changed

+522
-25
lines changed

Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ WORKDIR /data
1010
RUN apt-get update && apt-get -y --no-install-recommends upgrade && apt-get install -y --no-install-recommends \
1111
git \
1212
jq \
13-
nano \
14-
vim \
1513
bash \
1614
bash-completion \
1715
iputils-ping \
1816
telnet \
1917
dnsutils \
2018
net-tools \
21-
tcpdump \
2219
&& apt-get clean \
2320
&& rm -rf /var/lib/apt/lists/*
2421

@@ -37,4 +34,4 @@ RUN yarn build
3734

3835
EXPOSE 3000
3936

40-
CMD ["yarn", "run", "start:prod"]
37+
CMD ["/data/scripts/checkinstall.sh;yarn", "run", "start:prod"]

default/identities-columns.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
entries:
2+
- name: inetOrgPerson.uid
3+
label: ID
4+
field:
5+
type: function
6+
value: row?.inetOrgPerson?.uid
7+
align: left
8+
sortable: true
9+
10+
- name: inetOrgPerson.employeeNumber
11+
label: EmployeeNumber
12+
field:
13+
type: function
14+
value: row?.inetOrgPerson?.employeeNumber
15+
align: left
16+
sortable: true
17+
18+
- name: additionalFields.attributes.supannPerson.supannTypeEntiteAffectation
19+
label: Affectation
20+
field:
21+
type: function
22+
value: row.additionalFields?.attributes?.supannPerson?.supannTypeEntiteAffectation
23+
format:
24+
type: function
25+
value: "Array.isArray(value) ? value?.join(', ') : value"
26+
align: left
27+
sortable: true
28+
29+
30+
- name: inetOrgPerson.sn
31+
label: Nom
32+
field:
33+
type: function
34+
value: row?.inetOrgPerson?.sn
35+
align: left
36+
sortable: true
37+
38+
- name: inetOrgPerson.givenName
39+
label: Prénom
40+
field:
41+
type: function
42+
value: row?.inetOrgPerson?.givenName
43+
align: left
44+
sortable: false

default/menus.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
entries:
2+
- icon: mdi-account-off
3+
label: Etudiants
4+
path: "/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[^additionalFields.attributes.supannPerson.supannTypeEntiteAffectation]=/etd/i"
5+
color: primary
6+
part: Affectations
7+
badgeValue: ETD
8+
9+
- icon: mdi-account-tie
10+
label: Administratifs
11+
path: "/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[^additionalFields.attributes.supannPerson.supannTypeEntiteAffectation]=/adm/i"
12+
color: primary
13+
part: Affectations
14+
badgeValue: ADM
15+
16+
- icon: mdi-account-group
17+
label: Enseignants
18+
path: "/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[^additionalFields.attributes.supannPerson.supannTypeEntiteAffectation]=/esn/i"
19+
color: primary
20+
part: Affectations
21+
badgeValue: ESN
22+

scripts/checkinstall.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
if [ ! -f /data/config/identities-columns.yml ];then
3+
cp /data/default/identities-columns.yml /data/config
4+
fi
5+
if [ ! -f /data/config/menus.yml ];then
6+
cp /data/default/menus.yml /data/config
7+
fi
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
<template lang="pug">
2+
div.flex
3+
div
4+
q-btn.q-mx-xs(@click="submit" color="positive" icon="mdi-check" v-show="!isNew" v-if="crud.update")
5+
q-tooltip.text-body2(slot="trigger") Enregistrer les modifications
6+
q-btn.q-mx-xs(v-if="props.identity?._id" @click="sync" color="orange-8" :disabled="props.identity.state != IdentityState.TO_VALIDATE" icon="mdi-sync")
7+
q-tooltip.text-body2(slot="trigger" v-if="props.identity.state == IdentityState.TO_VALIDATE") Synchroniser l'identité
8+
q-tooltip.text-body2(slot="trigger" v-else) L'état de l'identité ne permet pas de la synchroniser
9+
q-btn.q-mx-xs(v-if="props.identity?._id" @click="logs" color="grey-8" icon="mdi-file-document" :href="'/jobs?filters[:concernedTo.id]=' + props.identity?._id")
10+
q-tooltip.text-body2(slot="trigger") Voir les logs de l'identité
11+
</template>
12+
13+
<script lang="ts" setup>
14+
import { computed, ref, type Prop } from 'vue'
15+
import { IdentityState } from '~/constants'
16+
import { useQuasar } from 'quasar'
17+
import type { components, operations } from '#build/types/service-api'
18+
import { useRouter } from 'vue-router'
19+
import { useFetch } from 'nuxt/app'
20+
import { useIdentityStates } from '~/composables'
21+
import { useErrorHandling } from '#imports'
22+
23+
24+
type IdentityResponse = operations['IdentitiesController_search']['responses']['200']['content']['application/json']
25+
type Identity = components['schemas']['IdentitiesDto']
26+
const activation=ref(true)
27+
const props = defineProps({
28+
identity: {
29+
type: Object as PropType<Identity>,
30+
required: true,
31+
},
32+
crud: {
33+
type: Object,
34+
default: {},
35+
},
36+
isNew: {
37+
type: Boolean,
38+
required: true,
39+
},
40+
})
41+
const $q = useQuasar()
42+
const router = useRouter()
43+
const { getStateColor, getStateName } = useIdentityStates()
44+
const { handleError } = useErrorHandling()
45+
46+
const emits = defineEmits(['submit', 'sync', 'logs', 'create', 'delete'])
47+
48+
async function submit() {
49+
// console.log('submit from actions')
50+
emits('submit')
51+
}
52+
53+
async function create() {
54+
// console.log('submit from actions')
55+
emits('create')
56+
}
57+
function setActivateColor(){
58+
if (props.identity.lastBackendSync != ""){
59+
return "green"
60+
}else{
61+
return "grey"
62+
}
63+
}
64+
function showActivate(){
65+
if (props.identity.lastBackendSync != ""){
66+
return true
67+
}else{
68+
return false
69+
}
70+
}
71+
async function activate(){
72+
73+
74+
let message=""
75+
let bouton = ""
76+
let initialStatus=0
77+
if (props.identity.dataStatus === 0){
78+
message="Voulez vous vraiment désactiver l'identité"
79+
bouton="Désactiver"
80+
initialStatus=1
81+
}else{
82+
message="Voulez vous vraiment activer l'identité"
83+
bouton="Activer"
84+
initialStatus=0
85+
}
86+
debugger
87+
if (showActivate() === false){
88+
props.identity.dataStatus = initialStatus
89+
return
90+
}
91+
92+
$q.dialog({
93+
title: 'Confirmation',
94+
message: message,
95+
persistent: true,
96+
ok: {
97+
push: true,
98+
color: 'positive',
99+
label: bouton,
100+
},
101+
cancel: {
102+
push: true,
103+
color: 'negative',
104+
label: 'Annuler',
105+
},
106+
}).onOk(async() => {
107+
const requestOptions={method: 'POST',
108+
body:JSON.stringify({id:props.identity._id,status:props.identity.dataStatus === 1 ?true:false})}
109+
try{
110+
const data=await $http.post('/management/identities/activation', requestOptions)
111+
$q.notify({
112+
message: 'Le statut a été mis à jour : ',
113+
color: 'positive',
114+
position: 'top-right',
115+
icon: 'mdi-check-circle-outline',
116+
})
117+
}catch(error){
118+
props.identity.dataStatus = initialStatus
119+
$q.notify({
120+
message: 'Impossible de modifier le statut : ' + error.response._data.message,
121+
color: 'negative',
122+
position: 'top-right',
123+
icon: 'mdi-alert-circle-outline',
124+
})
125+
}
126+
127+
}).onCancel(() =>{
128+
props.identity.dataStatus=initialStatus
129+
})
130+
131+
}
132+
133+
134+
async function deleteIdentity() {
135+
$q.dialog({
136+
title: 'Confirmation',
137+
message: 'Voulez-vous vraiment supprimer cette identité ?',
138+
persistent: true,
139+
ok: {
140+
push: true,
141+
color: 'positive',
142+
label: 'Supprimer',
143+
},
144+
cancel: {
145+
push: true,
146+
color: 'negative',
147+
label: 'Annuler',
148+
},
149+
}).onOk(() => {
150+
emits('delete')
151+
})
152+
}
153+
154+
const stateName = computed(() => {
155+
const state = props.identity?.state
156+
return getStateName(state)
157+
})
158+
159+
const stateColor = computed(() => {
160+
const state = props.identity?.state
161+
return getStateColor(state)
162+
})
163+
164+
async function sync() {
165+
emits('sync')
166+
}
167+
168+
async function sendInit(){
169+
//envoi le mail
170+
171+
const { data: result, pending, error, refresh } = await useHttp(`/management/passwd/init`, {
172+
method: 'POST',
173+
body: { uid: props.identity.inetOrgPerson.uid },
174+
});
175+
if (error.value) {
176+
handleError({
177+
error: error.value,
178+
message: 'Erreur lors de l\'envoi du mail'
179+
})
180+
} else {
181+
$q.notify({
182+
message: 'Le mail a été envoyé',
183+
color: 'positive',
184+
position: 'top-right',
185+
icon: 'mdi-check-circle-outline',
186+
})
187+
}
188+
}
189+
190+
function logs() {
191+
router.push(`/jobs?filters[:concernedTo.id]=${(props.identity as any)._id}`)
192+
}
193+
194+
function back() {
195+
router.push('/identities')
196+
}
197+
</script>

0 commit comments

Comments
 (0)