Skip to content

Commit 21d1170

Browse files
committed
probleme update
1 parent 47e988d commit 21d1170

File tree

8 files changed

+79
-8
lines changed

8 files changed

+79
-8
lines changed

.debpkg/DEBIAN/postinst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
/var/lib/sesame-daemon/backends-modules/openldap/update.sh

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222
cp src/config.yml .debpkg/var/lib/sesame-daemon/backends-modules/openldap
2323
cp README.md .debpkg/var/lib/sesame-daemon/backends-modules/openldap
2424
cp install.sh .debpkg/var/lib/sesame-daemon/backends-modules/openldap
25+
cp update.sh .debpkg/var/lib/sesame-daemon/backends-modules/openldap
2526
chmod 700 .debpkg/var/lib/sesame-daemon/backends-modules/openldap/install.sh
27+
chmod 700 .debpkg/var/lib/sesame-daemon/backends-modules/openldap/update.sh
2628
- uses: jiro4989/build-deb-action@v3
2729
with:
2830
package: sesame-backend-openldap

install.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ cp ./etc/* $INSTALL/etc
2121
mkdir $INSTALL/bin
2222
mkdir $INSTALL/lib
2323
PWD=`pwd`
24-
cp ./lib/__init__.py $INSTALL/lib
25-
ln -s $PWD/lib/backend_ldap_utils.py $INSTALL/lib/backend_ldap_utils.py
26-
ln -s $PWD/bin/changepwd.py $INSTALL/bin/changepwd.py
27-
ln -s $PWD/bin/ping.py $INSTALL/bin/ping.py
28-
ln -s $PWD/bin/resetpwd.py $INSTALL/bin/resetpwd.py
29-
ln -s $PWD/bin/upsertidentity.py $INSTALL/bin/upsertidentity.py
30-
ln -s $PWD/bin/delentity.py $INSTALL/bin/delentity.py
24+
for I in $PWD/lib/*;do
25+
ln -s $I $INSTALL/lib
26+
done
27+
for I in $PWD/bin/*;do
28+
ln -s $I $INSTALL/bin
29+
done
3130
chmod 700 $INSTALL/bin/*
3231
cp config.yml $INSTALL
3332
echo "Le backend a été installé dans $INSTALL"
@@ -36,6 +35,7 @@ echo "Configuration"
3635
read -p "Url du serveur ldap (ldap[s]://FDQN:PORT : " HOST
3736
read -p "Dn d'authentification (doit avoir les droits d'ecriture) : " DN
3837
read -s -p "Mot de passe : " PASSWORD
38+
echo ""
3939
read -p "Base ldap : " BASE
4040
read -p "Branche pour les utilisateurs ex: ou=peoples : " USERBASE
4141
read -p "Attribut pour le Rdn : " RDN
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"concernedTo":"67dd1e99e52d6011720ffd7f","payload":{"identity":{"action":"IDENTITY_UPDATE","identity":{"_id":"67dd1e99e52d6011720ffd7f","inetOrgPerson":{"cn":"Doloty Dimitri","displayName":"Dimitri Doloty","facsimileTelephoneNumber":"","givenName":"Dimitri","labeledURI":"","mail":"dimitri.doloty@lyon.archi.fr","mobile":"06 22 29 01 10","postalAddress":"70 chemin des Grenettes$69650,Quincieux","preferredLanguage":"","sn":"Doloty","telephoneNumber":"","title":"","uid":"ddoloty","employeeNumber":["161148"],"employeeType":"TAIGA","departmentNumber":["adm"],"jpegPhoto":"","userCertificate":""},"additionalFields":{"objectClasses":["supannPerson","eduPerson","sogxuser","ealPerson","supannCMS"],"attributes":{"ealPerson":{"ealnumcarte":"04307E3A1D3D80","ealwifi":"ProfAdmin","ealmail2":"","ealmobile2":"","ealformation":"","ealsituation":"","ealcycle":"","ealan":"","ealdepartement":"","ealnumetd":"","ealenseignement":[],"ealue":[]},"eduPerson":{"edupersonaffiliation":["staff","member","toto"],"edupersonprimaryaffiliation":"staff","edupersonprincipalname":"ddoloty@lyon.archi.fr"},"sogxuser":{"proxyaddress":["dolo@lyon.archi.fr","dim.dolo@lyon.archi.fr"],"sogxquota":0,"sogxdisableflag":0},"supannCMS":{"supannCMSId":["04307E3A1D3D80"]},"supannPerson":{"supannAutreMail":"dolo@free.fr","supannEmpId":"18","supannEntiteAffectationPrincipale":"Admin","supannEtablissement":"{UAI}0690184A","supannOIDCDatedeNaissance":"19/12/1971","supannOIDCGenre":"M.","supannPrenomsEtatCivil":"Dimitri","supannRefId":["{TAIGA}161148"],"supannTypeEntiteAffectation":["adm"],"supanncivilite":"M.","supannEntiteAffectation":["SIAM"],"supannNomdeNaissance":"","supannCodeINSEEPaysDeNaissance":"","supannCodeINSEEVilleDeNaissance":"","supannListeRouge":"","mailForwardingAddress":"","supannMailPerso":"","supannRoleGenerique":"","supannEtuId":"","supannCodeIne":"","supannParrainDN":"","supannActivite":"","supannEmpDateFin":"","supannEtuDiplome":"","supannEtuAnneeInscription":""}}},"customFields":{"photo":"adm-18.jpg"},"dataStatus":1,"deletedFlag":false,"initInfo":{"sentDate":"2025-04-11T09:14:21.853Z","initDate":"2025-04-11T09:09:44.219Z"},"initState":2,"lastBackendSync":"2025-04-14T09:45:53.983Z","lastSync":"2025-04-14T09:29:19.055Z","lifecycle":-1,"metadata":{"createdAt":"2025-03-21T08:08:57.552Z","createdBy":"Taiga","lastUpdatedAt":"2025-04-14T12:54:43.900Z","lastUpdatedBy":"alain.abbas"},"primaryEmployeeNumber":"","srcFusionId":"","state":2,"fingerprint":"14e4c3905c6497791d43599f3e04fc1157ff79de719ce4ab7ccd230d02ac8411"}}},"options":{"async":false,"updateStatus":true,"task":"67fd0595d5269d3e4fdf84cf"}}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
host=ldap://eal
2+
dn=cn=manager,cn=internal,dc=lyon,dc=archi,dc=fr
3+
password=Z3eru7
4+
base=dc=lyon,dc=archi,dc=fr
5+
userbase=ou=PERSONNES,dc=lyon,dc=archi,dc=fr
6+
rdnattribute=uid
7+
searchFilter=uid={{e.uid}}
8+
branchForEtd=ou=people
9+
branchForEsn=ou=people
10+
branchForAdm=ou=people
11+
branchForAss=ou=associations
12+
branchForFon=ou=bfonctionnelles
13+
branchForSyn=ou=syndicats
14+
branchForSta=ou=stagiaires
15+
branchForTec=ou=techniques
16+
backendFor=etd,adm,esn,fon,ass,syn,sta,tec
17+
branchAttr=departmentNumber
18+
disabledAttribute=sogxdisableflag
19+
disableValue=1
20+
enableValue=0
21+
additionnalObjectClass=sogxUser

unittest/ldapBinTest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,18 @@ def test_14desactivate_notconcerned(self):
116116
self.assertEqual(result["status"], 0)
117117
self.assertEqual(result["message"], "not concerned")
118118

119-
def test_99delentity(self):
119+
def test_19delentity(self):
120120
ret = self.run_backend('delentity.py', './files_ad_utils/identity1.json')
121121
self.assertEqual(ret['returncode'], 0)
122122
result = json.loads(ret["stdout"])
123123
self.assertEqual(result["status"], 0)
124124
self.assertEqual(result["message"], "user : uid=omaton,ou=adm,ou=PERSONNES,dc=lyon,dc=archi,dc=fr deleted")
125+
def test_20eduperson(self):
126+
ret = self.run_backend('upsertidentity.py', './files_ad_utils/eduPersonTest.json')
127+
self.assertEqual(ret['returncode'], 0)
128+
result = json.loads(ret["stdout"])
129+
self.assertEqual(result["status"], 0)
130+
self.assertEqual(result["message"], "Entree uid=omounier,ou=adm,ou=PERSONNES,dc=lyon,dc=archi,dc=fr mod")
125131

126132
if __name__ == '__main__':
127133
unittest.main()

unittest/ldapUtilsTest.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,26 @@ def test24_desactivation_entity(self):
182182
result = json.loads(x)
183183
self.assertEqual(result['status'], 0)
184184
self.assertEqual(result['message'],"Identity disabled")
185+
def test25_eduperson(self):
186+
config = u.read_config('./files_backend_utils/configeal.conf')
187+
ldap.set_config(config)
188+
data = u.get_config()
189+
l = ldap.connect_ldap(data['host'], data['dn'], data['password'])
190+
entity = u.readjsonfile("./files_ad_utils/edupersonTest.json")
191+
x = ldap.upsert_entry(l, entity)
192+
result = json.loads(x)
193+
self.assertEqual(result['status'], 0)
194+
self.assertEqual(result['message'], "Entree uid=ddoloty,ou=adm,ou=PERSONNES,dc=lyon,dc=archi,dc=fr mod")
195+
def test26_delete_entry(self):
196+
config = u.read_config('./files_backend_utils/config1.conf')
197+
ldap.set_config(config)
198+
data = u.get_config()
199+
l = ldap.connect_ldap(data['host'], data['dn'], data['password'])
200+
entity = u.readjsonfile("./files_ad_utils/identity1.json")
201+
x= ldap.delete_entity(l, entity)
202+
result = json.loads(x)
203+
self.assertEqual(result['status'], 0)
204+
self.assertEqual(result['message'], "user : uid=omaton,ou=esn,ou=PERSONNES,dc=lyon,dc=archi,dc=fr deleted")
185205

186206
def test99_delete_entry(self):
187207
config = u.read_config('./files_backend_utils/config1.conf')

update.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
echo "update du module LDAP"
3+
INSTALLDIR=../../backends
4+
echo "dir : " $INSTALLDIR
5+
BACKEND=openldap
6+
PWD=`pwd`
7+
for DIR in $INSTALLDIR/* ;do
8+
TYPE=`grep "name:" $DIR/config.yml|cut -f2 -d ' '|sed s/\'//g`
9+
if [ $TYPE = "openldap" ];then
10+
echo $DIR is openldap
11+
for I in $PWD/lib/*;do
12+
ln -s $I $DIR/lib
13+
done
14+
for I in $PWD/bin/*;do
15+
ln -s $I $DIR/bin
16+
done
17+
18+
fi
19+
done

0 commit comments

Comments
 (0)