From 0aa7178309c07a3fad7c755795fba06ab42ae031 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 29 Jan 2024 20:11:17 +0100 Subject: [PATCH] test: fix --- server/tests/steps/acl.test.ts | 5 +++-- server/tests/test_ldap.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/tests/steps/acl.test.ts b/server/tests/steps/acl.test.ts index 1d1a0c9c..9ac89138 100644 --- a/server/tests/steps/acl.test.ts +++ b/server/tests/steps/acl.test.ts @@ -1,6 +1,7 @@ 'use strict'; import { assert } from '../test_utils'; +import * as conf from '../../conf' import * as test_ldap from '../test_ldap'; import * as acl from '../../steps/acl'; @@ -76,12 +77,12 @@ describe('global', () => { )); it('loggedUser_to_ldap_filter should work', () => ( - acl.structureRoles('structureParrain', "(up1TableKey=*)").loggedUser_to_ldap_filter({ 'id': 'arigaux@univ-paris1.fr' } as CurrentUser).then(filter => ( + acl.structureRoles('structureParrain', "(up1TableKey=*)").loggedUser_to_ldap_filter({ 'id': 'arigaux' + conf.ldap.uid_to_eppn } as CurrentUser).then(filter => ( assert.deepEqual(filter, '(supannParrainDN=supannCodeEntite=DGH,ou=structures,dc=univ,dc=fr)') )) )); it('loggedUser_to_ldap_filter if user with no role', () => ( - acl.structureRoles('structureParrain', "(up1TableKey=*)").loggedUser_to_ldap_filter({ 'id': 'ayrigaux@univ-paris1.fr' } as CurrentUser).then(filter => ( + acl.structureRoles('structureParrain', "(up1TableKey=*)").loggedUser_to_ldap_filter({ 'id': 'ayrigaux' + conf.ldap.uid_to_eppn } as CurrentUser).then(filter => ( assert.deepEqual(filter, '(|(supannParrainDN=supannCodeEntite=DGH,ou=structures,dc=univ,dc=fr)(supannParrainDN=supannCodeEntite=DGHA,ou=structures,dc=univ,dc=fr))') )) )); diff --git a/server/tests/test_ldap.ts b/server/tests/test_ldap.ts index 7a777726..a7885c75 100644 --- a/server/tests/test_ldap.ts +++ b/server/tests/test_ldap.ts @@ -37,8 +37,8 @@ function test_params() { "[up1Source={COMPTEX}PLB.SC4][up1Priority=190][up1StartDate=20171216][up1EndDate=20181101][eduPersonAffiliation=employee;member;teacher][eduPersonEntitlement=urn:mace:univ-paris1.fr:entitlement:SC4:registered-reader][eduPersonPrimaryAffiliation=teacher][employeeNumber=9100035249][givenName=Pascal][homePhone=+33 1 82 09 08 74][homePostalAddress=6 Allée D'ANDREZIEUX$75018 PARIS$FRANCE][sn=Rigaux][supannCivilite=M.][supannEtablissement={UAI}0752719Y][supannOrganisme={EES}0752719Y][supannParrainDN=supannCodeEntite=SC4,ou=structures,dc=univ-paris1,dc=fr][supannRefId={MIFARE}803853C2593A04][up1BirthDay=19751002000000Z][up1BirthName=Nomdavant][up1TagMifare=8A38A3CA59AA0A]", ] }, { uid: "e10000000", sn: "rigaux", givenName: "pascal", cn: "rigaux pascal", displayName: "pascal rigaux", up1BirthDay: '19751002000000Z', eduPersonAffiliation: ['member','student'], supannEtuId: '22', mailHost: 'malix.univ-paris1.fr', objectClass: [] }, - { uid: "arigaux", sn: "rigaux", givenName: "aymé", cn: "rigaux ayme", displayName: "aymé rigaux", up1BirthDay: '19751002000000Z', eduPersonAffiliation: ['member','employee','staff'], objectClass: [], mail: "ayme.rigaux@univ-paris1.fr", eduPersonPrincipalName: "arigaux@univ-paris1.fr", supannRoleEntite: ["[role={SUPANN}D30][type={SUPANN}S230][code=DGH]"], memberOf: ["cn=g1,ou=groups,dc=univ,dc=fr"] }, - { uid: "ayrigaux", sn: "rigaux", givenName: "aymé", cn: "rigaux ayme", displayName: "aymé rigaux", up1BirthDay: '19750101000000Z', eduPersonAffiliation: ['member','employee','staff'], objectClass: [], eduPersonPrincipalName: "ayrigaux@univ-paris1.fr", supannRoleEntite: ["[role={SUPANN}D30][type={SUPANN}S230][code=DGH]", "[role={SUPANN}D10][type={SUPANN}S230][code=DGHA]"] }, + { uid: "arigaux", sn: "rigaux", givenName: "aymé", cn: "rigaux ayme", displayName: "aymé rigaux", up1BirthDay: '19751002000000Z', eduPersonAffiliation: ['member','employee','staff'], objectClass: [], mail: "ayme.rigaux@univ-paris1.fr", eduPersonPrincipalName: "arigaux@univ.fr", supannRoleEntite: ["[role={SUPANN}D30][type={SUPANN}S230][code=DGH]"], memberOf: ["cn=g1,ou=groups,dc=univ,dc=fr"] }, + { uid: "ayrigaux", sn: "rigaux", givenName: "aymé", cn: "rigaux ayme", displayName: "aymé rigaux", up1BirthDay: '19750101000000Z', eduPersonAffiliation: ['member','employee','staff'], objectClass: [], eduPersonPrincipalName: "ayrigaux@univ.fr", supannRoleEntite: ["[role={SUPANN}D30][type={SUPANN}S230][code=DGH]", "[role={SUPANN}D10][type={SUPANN}S230][code=DGHA]"] }, /* tslint:enable */ ]; let rolesGeneriques = [