Merge branch 'main' of https://gitlab2.istic.univ-rennes1.fr/tuvu/hackathon
This commit is contained in:
66
README.md
66
README.md
@@ -84,3 +84,69 @@ Pour appliquer le thème de connexion personnalisé fourni dans `keycloak/themes
|
|||||||
- Tuan Minh VU
|
- Tuan Minh VU
|
||||||
- Amäel KESTEMAN
|
- Amäel KESTEMAN
|
||||||
- Alexis LEBOEUF
|
- Alexis LEBOEUF
|
||||||
|
## Domain model class diagram
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
classDiagram
|
||||||
|
%% Classes and attributes (inferred from metier package)
|
||||||
|
class User {
|
||||||
|
+Long id
|
||||||
|
+String keycloakId
|
||||||
|
+String email
|
||||||
|
+String nom
|
||||||
|
+String prenom
|
||||||
|
+Role role
|
||||||
|
}
|
||||||
|
|
||||||
|
class Athlete {
|
||||||
|
+String categorie
|
||||||
|
+String niveau
|
||||||
|
+List<String> groupe
|
||||||
|
+List<Session> sessions
|
||||||
|
}
|
||||||
|
|
||||||
|
%% Represente en enum
|
||||||
|
class Role {
|
||||||
|
+String role
|
||||||
|
}
|
||||||
|
|
||||||
|
class Coach {
|
||||||
|
+List<Session> sessions
|
||||||
|
}
|
||||||
|
|
||||||
|
class Admin {
|
||||||
|
}
|
||||||
|
|
||||||
|
class Activite {
|
||||||
|
+Long id
|
||||||
|
+String nom
|
||||||
|
+String theme
|
||||||
|
+String description
|
||||||
|
+Integer dureeMinutes
|
||||||
|
+List<Activite> activites
|
||||||
|
+Session session
|
||||||
|
}
|
||||||
|
|
||||||
|
class Session {
|
||||||
|
+Long id
|
||||||
|
+String name
|
||||||
|
+LocalDateTime creneau
|
||||||
|
+Integer duree
|
||||||
|
+String group
|
||||||
|
+bool isRecurrent
|
||||||
|
+Coach coach
|
||||||
|
+List<Athlete> athletes
|
||||||
|
}
|
||||||
|
|
||||||
|
%% Inheritance (if User is a base class for domain actors)
|
||||||
|
User <|-- Athlete
|
||||||
|
User <|-- Coach
|
||||||
|
User <|-- Admin
|
||||||
|
|
||||||
|
%% Associations with cardinality
|
||||||
|
Coach "1" -- "0..*" Session : manages
|
||||||
|
Role "1" -- "0..*" User : is
|
||||||
|
Session "0..*" -- "0..*" Activite : contains
|
||||||
|
Session "0..*" -- "0..*" Athlete : participants
|
||||||
|
Activite "0..*" -- "0..*" Session : usedIn
|
||||||
|
```
|
||||||
|
|||||||
@@ -30,11 +30,9 @@ public class WebSecurityConfig {
|
|||||||
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||||
// 2. Allow public endpoints BEFORE any authenticated() calls
|
// 2. Allow public endpoints BEFORE any authenticated() calls
|
||||||
.requestMatchers("/athlete/create", "/", "/public").permitAll()
|
.requestMatchers("/athlete/create", "/", "/public").permitAll()
|
||||||
.requestMatchers("/coach/**").permitAll()
|
.requestMatchers("/coach/**").hasRole("coach")
|
||||||
// 3. Authenticated endpoints
|
|
||||||
.requestMatchers("/users/sync").authenticated()
|
|
||||||
.requestMatchers("/admin/**").hasRole("admin")
|
.requestMatchers("/admin/**").hasRole("admin")
|
||||||
.requestMatchers("/user/**").hasRole("user")
|
.requestMatchers("/athlete/**").hasRole("athlete")
|
||||||
.anyRequest().authenticated())
|
.anyRequest().authenticated())
|
||||||
.oauth2ResourceServer(oauth2 -> oauth2
|
.oauth2ResourceServer(oauth2 -> oauth2
|
||||||
.jwt(jwt -> jwt.jwtAuthenticationConverter(jwtToken -> {
|
.jwt(jwt -> jwt.jwtAuthenticationConverter(jwtToken -> {
|
||||||
|
|||||||
@@ -140,7 +140,6 @@ public class AthleteResource {
|
|||||||
athlete.setName(dto.getName());
|
athlete.setName(dto.getName());
|
||||||
athlete.setCategorie(dto.getCategorie());
|
athlete.setCategorie(dto.getCategorie());
|
||||||
athlete.setNiveau(dto.getNiveau());
|
athlete.setNiveau(dto.getNiveau());
|
||||||
|
|
||||||
// Relationship: sessionId → session
|
// Relationship: sessionId → session
|
||||||
if (dto.getSessionIds() != null) {
|
if (dto.getSessionIds() != null) {
|
||||||
List<Session> sessions = new ArrayList<>();
|
List<Session> sessions = new ArrayList<>();
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ export async function loginOrRegister(keycloak:Keycloak): Promise<User|null>{
|
|||||||
newAdmin.email = keycloak.tokenParsed.email || "";
|
newAdmin.email = keycloak.tokenParsed.email || "";
|
||||||
newAdmin.nom = keycloak.tokenParsed.family_name || "";
|
newAdmin.nom = keycloak.tokenParsed.family_name || "";
|
||||||
newAdmin.prenom = keycloak.tokenParsed.given_name || "";
|
newAdmin.prenom = keycloak.tokenParsed.given_name || "";
|
||||||
console.log(newAdmin.keycloakId);
|
|
||||||
console.log(newAdmin.toDTO().id_keycloak);
|
|
||||||
const response = await adminService.create(newAdmin.toDTO());
|
const response = await adminService.create(newAdmin.toDTO());
|
||||||
const admin = new Admin(response.data);
|
const admin = new Admin(response.data);
|
||||||
return admin;
|
return admin;
|
||||||
|
|||||||
Reference in New Issue
Block a user