Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #339

Closed
wants to merge 118 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
7a2ddab
Hel 494/create connexion page (#331)
nbenyahiadev Jul 3, 2023
d4b0991
(hel-502) change wording from activités sanitaires to activités méd…
schlaifa Jul 4, 2023
756f6d0
(hel-499) (hel-499/hel-500/hel-501) graphics design bug correction (#…
schlaifa Jul 5, 2023
bdffbcf
Hel 495/auth interaction helios (#336)
s-ferre-cat Jul 6, 2023
d2d8e18
Hel 496/script insertion utilisateurs (#337)
s-ferre-cat Jul 6, 2023
8a41b71
Hel 503/mot passe oublie (#333)
AnisHAKIMCATAMANIA Jul 7, 2023
14e33ab
fix sftp path
nbenyahiadev Jul 7, 2023
9c284fb
(hel-494) add sha-256 algorithm when login
nbenyahiadev Jul 10, 2023
8154b7f
Merge branch 'develop' of https://github.com/DNUM-SocialGouv/helios i…
nbenyahiadev Jul 10, 2023
784ab26
remove secret from helper
nbenyahiadev Jul 10, 2023
2c91212
fix yarn lock
nbenyahiadev Jul 10, 2023
ff36a58
fix yarn lock
nbenyahiadev Jul 10, 2023
ec0c03c
fix package json (#340)
nbenyahiadev Jul 10, 2023
b80c755
fix ci import utilisateurs
nbenyahiadev Jul 26, 2023
7af7d45
fix ci for python lint
nbenyahiadev Jul 26, 2023
f7d0440
(hel-510) change wording back to connexion button (#341)
schlaifa Aug 8, 2023
74cc1ed
(hel-513) allow majus and minus emails (#345)
schlaifa Aug 8, 2023
208709d
(hel-511) check if email exists before sending email to reset pwd (#342)
schlaifa Aug 8, 2023
0a78d72
(hel-514) add firstname to header (#346)
schlaifa Aug 8, 2023
e099250
(hel-517) create profile page (#344)
schlaifa Aug 10, 2023
fabc73a
(hel-520) correct email wording (#352)
schlaifa Aug 10, 2023
0e626cc
Hel 521/secure access (#355)
schlaifa Aug 10, 2023
e1d9f01
(hel-512) url expires within 72 hours (#356)
schlaifa Aug 11, 2023
f696fe4
Hel 522/use different pwd (#350)
schlaifa Aug 14, 2023
38ca1a8
(hel-515) force reload when clicking on browser arrow back button (#357)
schlaifa Aug 14, 2023
7eddf21
fix code issues
schlaifa Aug 14, 2023
ce21bde
Merge branch 'develop' of https://github.com/DNUM-SocialGouv/helios i…
schlaifa Aug 14, 2023
f7dd2d0
Hel 509/search history (#349)
schlaifa Aug 21, 2023
140d637
filter v1
schlaifa Sep 4, 2023
2f55036
gestion profils profil7 ET MS
schlaifa Sep 4, 2023
e9389d6
(hel-524) fix wording problem (#361)
schlaifa Sep 6, 2023
c32cbd9
fix bugs (#359)
schlaifa Sep 6, 2023
56f828a
Hel 502/bug calcul donut (#358)
schlaifa Sep 6, 2023
598d1b9
EJ/ET-MS IHM filters
schlaifa Sep 8, 2023
52c13ba
Hel 509/search history (#360)
schlaifa Sep 8, 2023
b680e2f
ET SAN front filters
schlaifa Sep 11, 2023
9d80d8a
(hel-525) change reinitialisation email wording (#362)
schlaifa Sep 11, 2023
08d08b4
fix code issues
schlaifa Sep 11, 2023
8c56b95
mettre en place la version
schlaifa Sep 11, 2023
3d6509c
change notAuthrized title style
schlaifa Sep 12, 2023
75184bf
mise en place de la table de reference departement region
schlaifa Sep 13, 2023
1685c86
add codeRegion to updateET and updateEJ scripts
schlaifa Sep 15, 2023
2dd3442
merge develop into gestion-profils
schlaifa Sep 18, 2023
bbdda0b
filter EJ data with user profil coming from database
schlaifa Sep 20, 2023
e05f3dc
filter ET-MS data with user profil coming from database
schlaifa Sep 20, 2023
d541d71
filter ET-SAN data with user profil coming from database
schlaifa Sep 21, 2023
71d7eee
combine profiles
schlaifa Sep 21, 2023
3a3a21c
first draft of profiles
nbenyahiadev Sep 23, 2023
66e341c
correct combine profiles logic
schlaifa Sep 25, 2023
1b4a569
profiles tabs draft
schlaifa Sep 25, 2023
a96e6f7
Merge branch 'hel/profiles' into gestion-profils
schlaifa Sep 25, 2023
d3f92bb
setting profiles new design
schlaifa Sep 25, 2023
6925632
get profiles from server
schlaifa Sep 26, 2023
bab2e97
get profile by code from server
schlaifa Sep 26, 2023
a9de003
save profile changes in server
schlaifa Sep 27, 2023
695582a
save new profile in server
schlaifa Sep 28, 2023
79b9d9c
correct unit tests
schlaifa Sep 28, 2023
7efa9e0
secure ws get/add/update profile and make setting page authorized onl…
schlaifa Oct 2, 2023
9c2dba7
(hel-529) correct merge issues
schlaifa Oct 3, 2023
0ec109a
(hel-529) fix code issues
schlaifa Oct 5, 2023
bc213eb
Hel 529/gestion profils (#363)
schlaifa Oct 5, 2023
4b14057
Merge branch 'develop' of https://github.com/DNUM-SocialGouv/helios i…
schlaifa Oct 5, 2023
09c531a
Hel 529/gestion profils (#364)
schlaifa Oct 9, 2023
868bf79
Merge branch 'develop' of https://github.com/DNUM-SocialGouv/helios i…
schlaifa Oct 9, 2023
9004b9c
Registration page (#365)
schlaifa Oct 9, 2023
2d3eaa4
Merge branch 'develop' of https://github.com/DNUM-SocialGouv/helios i…
schlaifa Oct 9, 2023
783774d
Hel 529/gestion profils (#366)
schlaifa Oct 10, 2023
0140062
Merge branch 'develop' of https://github.com/DNUM-SocialGouv/helios i…
schlaifa Oct 10, 2023
d2959f3
add new version
schlaifa Oct 10, 2023
67e5d92
add new version
schlaifa Oct 10, 2023
e3f7f75
(hel-526) (hel-517)
schlaifa Oct 10, 2023
4f92aad
(hel-547) change profile page wording (#370)
schlaifa Oct 26, 2023
b50ff05
(hel-544) fix bug indicator bloc budget (#369)
schlaifa Oct 26, 2023
e29887a
(hel-531) seperate the donut legend plugin and the bar legend plugin …
schlaifa Oct 26, 2023
fd0d15a
(hel-532) ne pas afficher les blocs si les donnees ne sont pas rensei…
schlaifa Oct 26, 2023
7cbb617
(hel-545) fix inscription rules (#372)
schlaifa Oct 26, 2023
ae5025c
(hel-542) warn user if his email is already used (#371)
schlaifa Oct 26, 2023
f63211a
config v1.1.1
schlaifa Oct 26, 2023
be28ec7
(hel-550) (hel-551) remove search bar from rgistration page and reini…
schlaifa Oct 31, 2023
f4a4ba7
(hel-552) flush cache at logout (#373)
schlaifa Oct 31, 2023
ce38734
(hel-541) change wording (#375)
schlaifa Oct 31, 2023
154531a
(hel-540) correct filter to show category (#376)
schlaifa Oct 31, 2023
03cc89f
Hel 535/pdf layout (#377)
schlaifa Nov 2, 2023
1ae21ea
(hel-530) (hel-538) change emails wording (#379)
schlaifa Nov 2, 2023
8d9befc
version 1.1.2
schlaifa Nov 2, 2023
1f5f4e5
correct bug send emails
schlaifa Nov 6, 2023
d92d462
(hel-537) make admin page reachable for role 1 and role 2 (#382)
schlaifa Nov 13, 2023
6022dae
Hel 552/profile not correct (#381)
schlaifa Nov 21, 2023
966f07d
Hel 535/pdf layout (#383)
schlaifa Nov 21, 2023
9455317
(hel-554) fix wording (#385)
schlaifa Nov 21, 2023
9e707df
(hel-556) fix EJ indicateur wording (#387)
schlaifa Nov 21, 2023
ccb17cd
Hel 557/wording et san indicateur autorisation (#386)
schlaifa Nov 21, 2023
2d5051f
(hel-543) Etablissements specifiques CPTS Message specifique pour ab…
schlaifa Nov 22, 2023
4b30a29
Hel 555/page outre mer buttons (#384)
schlaifa Nov 22, 2023
df10b25
version 1.1.3
schlaifa Nov 22, 2023
fc1a137
Hel 569/wording page profil (#388)
schlaifa Dec 1, 2023
ffb707c
Hel 568/respect accessibility (#390)
schlaifa Dec 1, 2023
8d6203f
Hel 561/create pwd page (#392)
schlaifa Dec 1, 2023
74538b5
Hel 555/page outre mer buttons (#393)
schlaifa Dec 1, 2023
c255ea6
Hel 564/settings page available only for national admins (#394)
schlaifa Dec 4, 2023
4e0e4d9
Hel 538/resize logo (#396)
schlaifa Dec 4, 2023
4840a19
Hel 571/wording footer pages (#395)
schlaifa Dec 4, 2023
e32268a
Hel 566/wording page parametrage (#389)
schlaifa Dec 4, 2023
bfbd42e
Hel 562/forgot pwd message (#397)
schlaifa Dec 4, 2023
4bbca64
Hel 552/profile not correct (#398)
schlaifa Dec 4, 2023
1957314
version 1.1.4
schlaifa Dec 4, 2023
d23df7d
fix merge conflicts
schlaifa Dec 4, 2023
d098a45
Hel 566/wording page parametrage (#399)
schlaifa Dec 4, 2023
fdedb72
fix migration issue
schlaifa Dec 4, 2023
415a4ad
Merge branch 'develop' of https://github.com/DNUM-SocialGouv/helios i…
schlaifa Dec 4, 2023
f573609
fix migration issue
schlaifa Dec 4, 2023
dd1f6f5
fix migration issue
schlaifa Dec 4, 2023
3bced48
Hel 561/create pwd page (#400)
schlaifa Dec 7, 2023
48245cd
fix budgetFinance bloc authorized bloc message order
schlaifa Dec 7, 2023
72c7be0
Hel 538/resize logo (#401)
schlaifa Dec 7, 2023
1e7c1aa
version 1.1.5
schlaifa Dec 7, 2023
82e7ae0
(hel-575) delete search bar from create pwd page (#402)
schlaifa Dec 7, 2023
f7bd390
V1.1.6 and delete TEST from institution for prod
schlaifa Dec 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Registration page (#365)
* filter v1

* gestion profils profil7 ET MS

* EJ/ET-MS IHM filters

* ET SAN front filters

* change notAuthrized title style

* mise en place de la table de reference departement region

* add codeRegion to updateET and updateEJ scripts

fix unit tests errors

* filter EJ data with user profil coming from database

* filter ET-MS data with user profil coming from database

* filter ET-SAN data with user profil coming from database

* combine profiles

* first draft of profiles

* correct combine profiles logic

* profiles tabs draft

* setting profiles new design

* get profiles from server

* get profile by code from server

* save profile changes in server

* save new profile in server

* correct unit tests

* secure ws get/add/update profile and make setting page authorized only for admins

* (hel-529) correct merge issues

* work in progress

* ws create account

* (hel-529) fix code issues

* add code profile to profiles list table and save default profile in db

* add profiles to ws create accout

* correct ws create account password save

---------

Co-authored-by: NbyDev <n.benyahia@cat-amania.com>
  • Loading branch information
schlaifa and nbenyahiadev authored Oct 9, 2023
commit 9004b9c83b3e9fc5c20667f527b164bbaa943a2e
4 changes: 2 additions & 2 deletions database/dataSource.ts
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ import { AjoutTableSearchHistory1691400360927 } from "./migrations/1691400360927
import { AjoutRefDepartementRegion1694523233904 } from "./migrations/1694523233904-AjoutRefDepartementRegion";
import { AjoutRégionDansEntitéJuridique1694616724703 } from "./migrations/1694616724703-AjoutRégionDansEntitéJuridique";
import { AjoutRégionDansEtablissementTerritorial1694617579347 } from "./migrations/1694617579347-AjoutRégionDansEtablissementTerritorial";
import { ajoutTableProfil1695731844298 } from "./migrations/1695731844278-ajoutTableProfil";
import { ajoutTableProfil1795731844298 } from "./migrations/1795731844278-ajoutTableProfil";
import { ActivitéMédicoSocialModel } from "./models/ActivitéMédicoSocialModel";
import { ActivitéSanitaireEntitéJuridiqueModel } from "./models/ActivitéSanitaireEntitéJuridiqueModel";
import { ActivitéSanitaireModel } from "./models/ActivitéSanitaireModel";
@@ -147,7 +147,7 @@ export default new DataSource({
AjoutRefDepartementRegion1694523233904,
AjoutRégionDansEntitéJuridique1694616724703,
AjoutRégionDansEtablissementTerritorial1694617579347,
ajoutTableProfil1695731844298,
ajoutTableProfil1795731844298,
],
type: "postgres",
url: environmentVariables.DATABASE_URL,
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { MigrationInterface, QueryRunner } from "typeorm"

export class ajoutTableProfil1695731844298 implements MigrationInterface {
import { DefaultProfile } from "../../src/frontend/configuration/DefaultProfile";

export class ajoutTableProfil1795731844298 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
CREATE TABLE public.profil(
@@ -13,6 +14,12 @@ export class ajoutTableProfil1695731844298 implements MigrationInterface {
profil_date_modification timestamp,
PRIMARY KEY (profil_id)
);`);

await queryRunner.query(
`INSERT INTO public.profil(profil_label, profil_value, profil_date_creation) VALUES ($1, $2, $3)`,
['Utilisateur lambda', DefaultProfile, new Date()]
);

}

public async down(queryRunner: QueryRunner): Promise<void> {
2 changes: 1 addition & 1 deletion database/models/UtilisateurModel.ts
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ export class UtilisateurModel {
@Column({ name: "ut_password", nullable: true })
public password!: string;

@Column('simple-array', { nullable: true, name: "ut_profiles" })
@Column("text", { array: true, nullable: true, name: "ut_profiles" })
public profils: string[] = [];

@CreateDateColumn({ name: "ut_date_creation" })
12 changes: 12 additions & 0 deletions src/backend/infrastructure/controllers/createAccountEndpoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { LoginUseCase } from "../../métier/use-cases/LoginUseCase";
import { Dependencies } from "../dependencies";

export async function createAccountEndpoint(dependencies: Dependencies, firstName: string, lastName: string, email: string, institution: string): Promise<void> {
try {
const loginUseCase = new LoginUseCase(dependencies.utilisateurLoader);
return await loginUseCase.createAccount(firstName, lastName, email, institution);
} catch (error) {
dependencies.logger.error(error);
throw error;
}
}
13 changes: 13 additions & 0 deletions src/backend/infrastructure/controllers/getInstitutionsEndpoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Institution } from "../../métier/entities/Utilisateur/Institution";
import { LoginUseCase } from "../../métier/use-cases/LoginUseCase";
import { Dependencies } from "../dependencies";

export async function getInstitutionsEndpoint(dependencies: Dependencies): Promise<Institution[]> {
try {
const loginUseCase = new LoginUseCase(dependencies.utilisateurLoader);
return await loginUseCase.getInstitutions();
} catch (error) {
dependencies.logger.error(error);
throw error;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { compare } from 'bcrypt';
import { compare, genSalt, hash } from 'bcrypt';
import { createHash } from 'crypto';
import { DataSource } from "typeorm";

import { InstitutionModel } from '../../../../../database/models/InstitutionModel';
import { ProfilModel } from '../../../../../database/models/ProfilModel';
import { RoleModel } from '../../../../../database/models/RoleModel';
import { UtilisateurModel } from "../../../../../database/models/UtilisateurModel";
import { Institution } from '../../../métier/entities/Utilisateur/Institution';
import { RésultatLogin } from "../../../métier/entities/Utilisateur/RésultatLogin";
import { UtilisateurLoader } from "../../../métier/gateways/UtilisateurLoader";
import { sendEmail } from '../../../sendEmail';


export class TypeOrmUtilisateurLoader implements UtilisateurLoader {
@@ -30,6 +34,51 @@ export class TypeOrmUtilisateurLoader implements UtilisateurLoader {
} else return false;
}

async getInstitutions(): Promise<Institution[]> {
const institutions = await (await this.orm).getRepository(InstitutionModel).find();
return institutions;
}

async createAccount(firstName: string, lastName: string, email: string, institution: string): Promise<void> {
try {
const account = new UtilisateurModel();

const institutionToSave = await (await this.orm).getRepository(InstitutionModel).findOneBy({ code: institution });
const roleToSave = await (await this.orm).getRepository(RoleModel).findOneBy({ code: 'USER' });
const profileToSave = await (await this.orm).getRepository(ProfilModel).findOneBy({ id: 1 });

const passwordToSave = 'HeliosConnect-' + institutionToSave?.codeGeo;

const salt = await genSalt(10);
const hashedPassword = await hash(passwordToSave, salt);

if (institutionToSave && roleToSave && profileToSave) {
account.nom = lastName;
account.prenom = firstName;
account.email = email;
account.institution = institutionToSave;
account.role = roleToSave;
account.password = hashedPassword;
account.profils = [profileToSave.code];
account.actif = true;
account.dateCreation = new Date();
}

(await this.orm).getRepository(UtilisateurModel).save(account)
.then(async () => {
sendEmail(email, 'Creation de compte Helios', 'hello')
})
.catch((error) => {
// eslint-disable-next-line no-console
console.log("error", error);
});

} catch (error) {
// eslint-disable-next-line no-console
console.log("error", error);
}
}

async checkIfAdmin(userId: string): Promise<boolean> {
const user = await (await this.orm).getRepository(UtilisateurModel).findOneBy({ code: userId.trim() });
if (user && user.roleId === '1') {
3 changes: 3 additions & 0 deletions src/backend/métier/gateways/UtilisateurLoader.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { ProfilModel } from "../../../../database/models/ProfilModel";
import { Institution } from "../entities/Utilisateur/Institution";
import { RésultatLogin } from "../entities/Utilisateur/RésultatLogin";

export interface UtilisateurLoader {
login(email: string, password: string): Promise<RésultatLogin>;
checkIfEmailExists(email: string): Promise<boolean>;
getInstitutions(): Promise<Institution[]>;
createAccount(firstName: string, lastName: string, email: string, institution: string): Promise<void>;
getUserProfiles(codes: string[]): Promise<ProfilModel[] | null>;
checkIfAdmin(userId: string): Promise<boolean>
}
10 changes: 10 additions & 0 deletions src/backend/métier/use-cases/LoginUseCase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ProfilModel } from "../../../../database/models/ProfilModel";
import { Institution } from "../entities/Utilisateur/Institution";
import { RésultatLogin } from "../entities/Utilisateur/RésultatLogin";
import { UtilisateurLoader } from "../gateways/UtilisateurLoader";

@@ -13,6 +14,15 @@ export class LoginUseCase {
return await this.utilisateurLoader.checkIfEmailExists(email);
}

async getInstitutions(): Promise<Institution[]> {
return await this.utilisateurLoader.getInstitutions();
}

async createAccount(firstName: string, lastName: string, email: string, institution: string): Promise<void> {

return this.utilisateurLoader.createAccount(firstName, lastName, email, institution);
}

async checkIfAdmin(userId: string): Promise<boolean> {
return await this.utilisateurLoader.checkIfAdmin(userId);
}
29 changes: 29 additions & 0 deletions src/backend/sendEmail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const buildEmailBody = (receiver: string, subject: string, htmlBody: string) => {
const body = {
to: [
{
address: receiver,
}
],
msg: {
from: {
personalName: process.env['TIPIMAIL_SENDER_NAME'],
address: process.env['TIPIMAIL_SENDER_ADDRESS']
},
subject: subject,
html: htmlBody

}
}
return JSON.stringify(body);
}

export const sendEmail = async (receiver: string, subject: string, htmlBody: string) => await fetch('https://api.tipimail.com/v1/messages/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Tipimail-ApiUser': process.env['TIPIMAIL_APIUSER'] || '',
'X-Tipimail-ApiKey': process.env['TIPIMAIL_APIKEY'] || ''
},
body: buildEmailBody(receiver, subject, htmlBody)
});
Loading