Skip to content

Commit c7cfa00

Browse files
committed
Update inetOrgPerson DTO to include employeeType field
1 parent df6874d commit c7cfa00

File tree

11 files changed

+42
-12
lines changed

11 files changed

+42
-12
lines changed

docs/technical/Tests.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const inetOrgPersonDtoStub = (): inetOrgPersonDto => {
9696
sn: 'sn',
9797
uid: 'uid',
9898
employeeNumber: 'employeeNumber',
99+
employeeType: 'employeeType',
99100
displayName: 'displayName',
100101
facsimileTelephoneNumber: 'facsimileTelephoneNumber',
101102
givenName: 'givenName',

docs/user/IdentitiesCreation.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ Lors de la création d'une identité, le corps de la requête doit inclure les i
4242

4343
#### Informations de Base (`inetOrgPerson`)
4444

45-
Les informations de base de l'identité sont définies dans l'objet `inetOrgPerson`. Les champs requis sont `cn` (Nom Commun), `sn` (Nom de Famille), `uid` (Identifiant Unique), et `employeeNumber` (Identifiant Identité). Ces champs sont validés en dur.
45+
Les informations de base de l'identité sont définies dans l'objet `inetOrgPerson`. Les champs requis sont `cn` (Nom Commun), `sn` (Nom de Famille), `uid` (Identifiant Unique), et `employeeNumber` + `employeeType` (Identifiant Identité). Ces champs sont validés en dur.
4646

4747
##### Champs obligatoires :
4848
- `cn`
4949
- `sn`
5050
- `uid`
5151
- `employeeNumber`
52+
- `employeeType`
5253

5354
##### Champs facultatifs :
5455
- `displayName`
@@ -95,6 +96,7 @@ Voici un exemple de corps de requête pour la création d'une identité avec les
9596
"sn": "Nom de Famille",
9697
"uid": "Identifiant Unique",
9798
"employeeNumber": "Identifiant Identité"
99+
"employeeType": "Type Identité"
98100
},
99101
"additionalFields": {
100102
"objectClasses": ["supann"],
@@ -121,7 +123,8 @@ curl -X POST "http://<adresse-du-serveur>/identities" \
121123
"cn": "Nom Commun",
122124
"sn": "Nom de Famille",
123125
"uid": "Identifiant Unique",
124-
"employeeNumber": "Identifiant Identité"
126+
"employeeNumber": "Identifiant Identité",
127+
"employeeType": "Type Identité"
125128
},
126129
"additionalFields": {
127130
"objectClasses": ["supann"],
@@ -163,7 +166,7 @@ Même procédure pour la validation, mais ici nous avons :
163166

164167
### Corps de la Requête (Body)
165168

166-
Lors de la création d'une identité, le corps de la requête doit inclure au moins la données (`inetOrgPerson.uid`) et (`inetOrgPerson.employeeNumber`), ainsi que tout champ additionnel nécessaire selon l'`objectClass` spécifique. Notez que l'objet `inetOrgPerson` est validé en dur et non via un fichier YAML.
169+
Lors de la création d'une identité, le corps de la requête doit inclure au moins la données (`inetOrgPerson.uid`) et (`inetOrgPerson.employeeNumber` + `inetOrgPerson.employeeType`), ainsi que tout champ additionnel nécessaire selon l'`objectClass` spécifique. Notez que l'objet `inetOrgPerson` est validé en dur et non via un fichier YAML.
167170

168171
De plus pour une modification, il specifier le state a `-1`
169172

@@ -172,7 +175,8 @@ De plus pour une modification, il specifier le state a `-1`
172175
"state": -1,
173176
"inetOrgPerson": {
174177
"uid": "Identifiant Unique",
175-
"employeeNumber": "Identifiant Identite"
178+
"employeeNumber": "Identifiant Identite",
179+
"employeeType": "Type Identite"
176180
},
177181
"additionalFields": {
178182
"objectClasses": ["supann"],
@@ -195,7 +199,8 @@ De plus pour une modification, il specifier le state a `-1`
195199
"state": -1,
196200
"inetOrgPerson": {
197201
"uid": "Identifiant Unique",
198-
"employeeNumber": "Identifiant Identite"
202+
"employeeNumber": "Identifiant Identite",
203+
"employeeType": "Type Identite"
199204
},
200205
"additionalFields": {
201206
"objectClasses": ["supann"],

docs/user/IdentitiesValidation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Les champs de base de l'objet `inetOrgPerson` sont validés par défaut.
1414
- `sn`
1515
- `uid`
1616
- `employeeNumber`
17+
- `employeeType`
1718

1819
### Champs facultatifs :
1920
- `displayName`

src/management/identities/_dto/_parts/inetOrgPerson.dto.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export class inetOrgPersonCreateDto {
1414
@ApiProperty()
1515
employeeNumber: string;
1616

17+
@IsString()
18+
@ApiProperty()
19+
employeeType: string;
20+
1721
@IsString()
1822
@ApiProperty()
1923
@IsOptional()

src/management/identities/_schemas/_parts/inetOrgPerson.part.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,20 @@ export class inetOrgPerson {
4141
@Prop({ required: true, unique: true })
4242
uid: string;
4343

44-
@Prop({ required: true, unique: true })
44+
@Prop({ required: true })
4545
employeeNumber: string;
4646

47+
@Prop({ required: true })
48+
employeeType: string;
49+
4750
@Prop()
4851
userCertificate?: string;
4952

5053
@Prop()
5154
userPassword?: string;
5255
}
5356

54-
export const inetOrgPersonSchema = SchemaFactory.createForClass(inetOrgPerson);
57+
export const inetOrgPersonSchema = SchemaFactory.createForClass(inetOrgPerson).index(
58+
{ employeeNumber: 1, employeeType: 1 },
59+
{ unique: true },
60+
);

src/management/identities/_stubs/_parts/inetOrgPerson.dto.stub.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const inetOrgPersonDtoStub = (): inetOrgPersonDto => {
66
sn: 'sn',
77
uid: 'uid',
88
employeeNumber: 'employeeNumber',
9+
employeeType: 'employeeType',
910
displayName: 'displayName',
1011
facsimileTelephoneNumber: 'facsimileTelephoneNumber',
1112
givenName: 'givenName',

src/management/identities/identities.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class IdentitiesService extends AbstractServiceSchema {
7070
};
7171
}
7272

73-
//TODO: rechercher par uid ou employeeNumber ?
73+
//TODO: rechercher par uid ou employeeNumber + employeeType ?
7474
const upsert = await super.upsert({ 'inetOrgPerson.uid': data.inetOrgPerson.uid }, data, options);
7575
return upsert;
7676
//TODO: add backends service logic here

src/management/identities/jsonforms/_config/inetorgperson.ui.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
"options": {
3737
"required": true
3838
}
39+
},
40+
{
41+
"type": "Control",
42+
"label": "EmployeeType",
43+
"scope": "#/properties/employeeType",
44+
"options": {
45+
"required": true
46+
}
3947
}
4048
]
4149
},

src/management/identities/validations/_config/inetorgperson.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
"type": "string",
1919
"description": "EmployeeNumber of the inetOrgPerson."
2020
},
21+
"employeeType": {
22+
"type": "string",
23+
"description": "EmployeeType of the inetOrgPerson."
24+
},
2125
"displayName": {
2226
"type": "string",
2327
"description": "Display name of the inetOrgPerson."
@@ -68,5 +72,5 @@
6872
"description": "User password of the inetOrgPerson."
6973
}
7074
},
71-
"required": ["uid", "employeeNumber"]
75+
"required": ["uid", "employeeNumber", "employeeType"]
7276
}

src/management/passwd/passwd.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class PasswdController {
2424
public async change(@Body() cpwd: ChangePasswordDto, @Res() res: Response): Promise<Response> {
2525
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2626
const [_, data] = await this.passwdService.change(cpwd);
27-
//TODO: uid ou employeeNumber ?
27+
//TODO: uid ou employeeNumber + employeeType ?
2828
data.data.uid = cpwd.id;
2929
this.logger.log(`call passwd change for : ${cpwd.id}`);
3030

0 commit comments

Comments
 (0)