Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
38a3f10
feat(frontend): implement item management with list display and mock …
YohanKoch Feb 26, 2026
78a9d64
feat(frontend): enhance item management with detailed item attributes…
YohanKoch Feb 27, 2026
2c1ed32
Merge branch 'develop' of https://github.com/OrifInformatique/templat…
YohanKoch Mar 4, 2026
324e3dd
feat(frontend): update @orif-informatique/react-components-library to…
YohanKoch Mar 4, 2026
fab2f75
feat(frontend): refactor item management actions and update deletion …
YohanKoch Mar 4, 2026
3ff2d59
feat(frontend): implement item modification, deletion, restoration, a…
YohanKoch Mar 5, 2026
df38deb
feat(frontend): enhance item list component with improved action hand…
YohanKoch Mar 5, 2026
fade93d
feat(frontend): enhance item management with improved error handling,…
YohanKoch Mar 6, 2026
c84b607
feat(frontend): remove default actions label from item list component
YohanKoch Mar 6, 2026
f16a000
feat(frontend): add visual indication for soft-deleted items in list …
YohanKoch Mar 6, 2026
72008eb
feat(frontend): add confirmation dialog for permanent deletion of items
YohanKoch Mar 6, 2026
8570021
feat(frontend): implement item creation and editing form with API int…
YohanKoch Mar 19, 2026
54514d4
feature frontend : add a list to manage users according to their perm…
QuentinMory Apr 21, 2026
8cde8ff
feature(frontend): add a list to manage users depending to their perm…
QuentinMory Apr 22, 2026
1bcb9b7
hotfix(frontend): fix the imports in users/index.jsx
QuentinMory Apr 22, 2026
7182da2
Merge branch 'develop' into feature/frontend/admin-user
DidierViret Apr 22, 2026
feaa6bb
fix: add the "canView" const in items/ui/list.jsx
DidierViret Apr 22, 2026
f949cb4
feature (frontend) : add a column to see the application-specific rol…
QuentinMory Apr 27, 2026
13d783a
adapt the backend's delete method to the spring-auth's delete method
QuentinMory Apr 27, 2026
c5f264a
Merge branch 'feature/frontend/admin-user' of https://github.com/Orif…
QuentinMory Apr 27, 2026
af62feb
fix: fix the authClient's delete method to the method of spring-auth
QuentinMory Apr 27, 2026
58ca1bb
fix (frontend): Update the user's main role in spring-auth
QuentinMory May 4, 2026
6d718b7
Merge branch 'develop' into feature/frontend/admin-user
DidierViret May 5, 2026
5c001b0
fix(frontend): remove double importation for "List" component
DidierViret May 5, 2026
6c099e4
build(frontend): update package-lock.json
DidierViret May 5, 2026
85f7bca
fix : Correction requested by the pull request comments
QuentinMory May 6, 2026
7e98e90
Merge branch 'feature/frontend/admin-user' of https://github.com/Orif…
QuentinMory May 6, 2026
3af6ede
build(backend): suppress NonNull warnings
DidierViret May 6, 2026
44cee00
fix : modified Item.java so when the author is deleted, the column is…
QuentinMory May 8, 2026
cf90332
Merge branch 'feature/frontend/admin-user' of https://github.com/Orif…
QuentinMory May 8, 2026
f661d72
refactor: imports in alphabetical order
DidierViret May 8, 2026
07dfbdf
refactor: keep original imports spacing
DidierViret May 8, 2026
07e74f9
refactor: remove unused repository method to set author_id to null
DidierViret May 8, 2026
52d75fb
refactor: remove unused itemService method to set author to null
DidierViret May 8, 2026
2e6cd3c
refactor: remove findAll method from RoleRepository, allready defined…
DidierViret May 8, 2026
edd0256
doc: add comments for the new UserController's endpoints
DidierViret May 8, 2026
283ffc2
refactor: remove unused import
DidierViret May 8, 2026
c89ee5b
refactor: put imports in alphabetical order
DidierViret May 8, 2026
544e184
refactor: remove blank lines
DidierViret May 8, 2026
04ad5fc
refactor: finalize updateUser and restoreUser methods in UserService
DidierViret May 8, 2026
8620775
refactor: remove added blanklines
DidierViret May 12, 2026
7af741a
refactor(frontend): remove unusefull comments
DidierViret Jun 12, 2026
426e75d
Merge remote-tracking branch 'origin/develop' into feature/frontend/a…
DidierViret Jun 12, 2026
8da334c
Merge branch 'develop' into feature/frontend/admin-user
DidierViret Jun 25, 2026
a8c73a7
refactor(backend user): remove unused imports from UserService
DidierViret Jun 26, 2026
1e83160
refactor(backend items): remove hibernate session filter from item en…
DidierViret Jun 26, 2026
352809f
refactor(backend users): remove hibernate filter from User entity
DidierViret Jun 26, 2026
5578a10
refactor(backend items): fix an error in comments for getItems method
DidierViret Jun 30, 2026
e879e29
Revert "refactor(backend items): fix an error in comments for getItem…
DidierViret Jun 30, 2026
8d38d96
refactor(backend items): fix an error in comments for getItems method
DidierViret Jun 30, 2026
417069d
refactor(backend roles): add a RoleService layer between RoleControl…
DidierViret Jun 30, 2026
49cfd99
refactor(backend users): rework comments for UserService
DidierViret Jun 30, 2026
edbf96e
fix(frontend users): remove multiple requests for users list
Valentino-R Jul 1, 2026
99c30a8
Merge branch 'feature/frontend/admin-user' of https://github.com/Orif…
Valentino-R Jul 1, 2026
d265c66
fix(frontend, user): show deleted items refresh on click of delete us…
Valentino-R Jul 1, 2026
da84792
doc(clauds code): add a CLAUDE.md file generated with claude code in …
DidierViret Jul 2, 2026
071024c
intégration(feature admin user): intégration des paramètre mainRole e…
Valentino-R Jul 2, 2026
2cc957f
Merge branch 'feature/frontend/admin-user' of https://github.com/Orif…
Valentino-R Jul 2, 2026
78eaca1
feat[feature admin-user]: implémentation des paramètres mainRole et a…
Valentino-R Jul 7, 2026
f2f0ee6
fix: déplacement de la méthode setAppSpecificRoles en dehors de la bo…
Valentino-R Jul 7, 2026
33fd4c0
chore(backend user): rework comments in UserService
DidierViret Jul 8, 2026
d3ed6c7
fix(backend register): after user registrered, send back all local us…
DidierViret Jul 8, 2026
4ed2dd3
fix(tests): adapt tests to the new RegisterDto parameters
DidierViret Jul 8, 2026
451833d
refactor: remove unused authClient and related functions; simplify us…
YohanKoch Aug 12, 2026
3b4495e
fix:correction des endpoint et methode pour soft et hard delete global
Valentino-R Aug 13, 2026
491899f
Merge branch 'feature/frontend/admin-user' of https://github.com/Orif…
Valentino-R Aug 13, 2026
1ac00cd
fix: use right arguments when calling deleteGlobalUserPermanent in test
DidierViret Aug 25, 2026
cbefc4f
Merge branch 'develop' into feature/frontend/admin-user
DidierViret Aug 28, 2026
87943e9
feat: add authClient.updateUser
QuentinMory Aug 31, 2026
b1cc68a
feat : update the method updateUser
QuentinMory Aug 31, 2026
d3d6f10
refactor: call spring-auth before userService
QuentinMory Sep 1, 2026
8ea0e9c
refactor: call spring-auth in userService instead of userController
QuentinMory Sep 1, 2026
49188b0
chore: comment UserService updateUser method
DidierViret Sep 1, 2026
eee859e
fix: update redirect component to include dependencies in useEffect. …
YohanKoch Sep 1, 2026
9f8e628
refactor: update user deletion methods to use user login instead of u…
YohanKoch Sep 2, 2026
23bf10d
Merge branch 'develop' into feature/frontend/admin-user
DidierViret Sep 8, 2026
e280af4
refactor(backend): clean unused imports
DidierViret Sep 8, 2026
863bb14
refactor: remove unused OAuth2 login function from Login component
YohanKoch Sep 8, 2026
634889d
refactor(backend): rename "login" parameter to "userLogin"
DidierViret Sep 8, 2026
47a72a9
refactor(user): user login instead of id to identify the user to restore
DidierViret Sep 8, 2026
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
99 changes: 99 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Repository overview

This is a full-stack starter template with a React frontend and a Spring Boot backend, meant to be forked as the base for new applications. It ships with a `user` module (soft-delete, roles/permissions) and an `item` module (a worked CRUD example to copy when adding new domain modules). Authentication itself is **not** implemented here: it is delegated to an external `spring-auth` service (https://github.com/OrifInformatique/spring-auth) that this backend talks to over HTTP/WebClient.

Two independent projects live side by side:
- `backend/` — Spring Boot 3.5.8 / Java 21 REST API
- `frontend/` — React 19 SPA built with Webpack 5 and Tailwind

## Common commands

### Backend (`backend/`)

```bash
mvn spring-boot:run # run the app
mvn test # run all tests
mvn test -Dtest=ItemServiceTest # run a single test class
mvn test -Dtest=ItemServiceTest#methodName # run a single test method
mvn clean # remove target/ build artifacts
mvn package # build the .jar (also generates REST Docs via asciidoctor)
mvn validate # sanity-check project structure
```

Docker (preferred dev workflow):
```bash
docker compose build # rebuild after changing ENVIRONMENT in .env
docker compose up # start app + MariaDB containers
docker compose up -d # same, detached
docker exec -it <container name> sh # shell into a running container
```

Setup: copy `env-dist` → `.env` and `application.properties-dist` → `application.properties` (both are gitignored; never edit the `-dist` originals). `.env` controls `ENVIRONMENT` (dev/test/prod), the Tomcat port, DB URLs/credentials, the `spring-auth` base URL, Azure OAuth2 URLs, and JWT secret/lifetimes.

### Frontend (`frontend/`)

```bash
npm install
npm run serve # webpack-dev-server on PORT from .env (default 4000), proxies /auth, /users, /tests to BACKEND_API_URL
npm run build # production build
npm run storybook # Storybook on :6006
npm run build-storybook
```

Setup: copy `.env-template` → `.env` and adjust `APP_ROOT` if not serving from `/`.

There is no configured test runner or linter in `frontend/package.json` — don't assume `npm test` or `npm run lint` exist.

## Architecture

### Backend: layered, module-per-domain

Code lives under `ch.sectioninformatique.template`, one package per domain (`user`, `item`, `auth`, `security`, `app`, `config`, `test`). Entry point: `AuthApplication.java` (run this class, not a differently-named `*Application`). Each domain module generally follows Controller → Service → Repository, e.g. for `item`:

- `ItemController` — `@RestController`, endpoints guarded with `@PreAuthorize("hasAuthority('item:read')")` etc.
- `ItemService` — business logic, authorization checks against the authenticated user (author-or-admin ownership checks), talks to repositories
- `ItemRepository` (+ `ItemRepositoryImpl` for custom queries) — Spring Data JPA
- `ItemExceptions` — nested custom exceptions for this domain, thrown from the service and caught by the global handler
- `ItemBuilder`, `ItemSeeder`, `ItemsDTO` — builder, dev data seeding, response DTO

**`item` is the canonical example module** — when adding a new domain, copy its shape rather than inventing a new pattern. `user` follows the same shape but is more complex (soft delete + dual role model, see below).

### Auth is delegated, not implemented locally

`auth/AuthController` does not perform authentication itself — it relays requests (login, register, refresh, Azure OAuth2 callback) to the external `spring-auth` service via `auth/AuthClient` (a Spring WebFlux `WebClient`, configured in `security/WebClientConfig`). `spring-auth`'s base URL comes from `SPRING_AUTH_URL` in `.env`. Locally-issued JWTs from `spring-auth` are then validated on every request by `security/JwtAuthFilter` + `security/UserAuthenticationProvider`, which populate the Spring Security context. See `doc/frontend_backend_auth_architecture.mmd`/`.png` and `doc/process-documentation.md` for full sequence diagrams (standard login, Azure OAuth2 login, refresh token flow).

Azure OAuth2 login is a three-party redirect dance (Frontend ↔ this Backend ↔ spring-auth ↔ Azure): the backend receives a temporary auth code at `/auth/auth-code`, exchanges it with spring-auth for tokens, stashes them in the HTTP session, then the frontend polls `GET /auth/tokens` to retrieve and clear them. This is why `SecurityConfig` sets `SessionCreationPolicy.ALWAYS` even though the API is otherwise stateless/JWT-based.

### Roles and permissions

`security/RoleEnum` (USER, MANAGER, ADMIN, LOCAL_APP_ROLE) each map to a fixed `EnumSet<PermissionEnum>` (`security/PermissionEnum`, e.g. `item:read`, `user:write`) and are converted to Spring Security `GrantedAuthority`s (`ROLE_*` plus the individual permission strings) via `getGrantedAuthorities()`. Controllers authorize with `@PreAuthorize("hasAuthority('item:write')")`-style expressions, sometimes combined with `hasRole(...)`.

`User` supports **two kinds of role**: a global `mainRole` (managed by `spring-auth`, promoted via `AuthClient.promoteToAdmin`) and a `Set<Role> appSpecificRoles` that is local to this app only (promoted purely against the local DB via `UserService.promoteToLocalAppRole`). Don't conflate the two when adding role-related logic.

`User` also supports soft delete (`deleted` flag, default repository queries exclude it) alongside a separate permanent/hard-delete path (`UserRepositoryPermanentDelete`, `DELETE /users/{id}/false/permanent`) that also cleans up the `users_app_specific_roles` join table first.

### Error handling and i18n

Domain exceptions extend `app/exceptions/AppException` (carries an HTTP status) and implement `MessageKeyProvider` (exposes an i18n message key + format args) rather than a hardcoded message. `app/exceptions/GlobalExceptionHandler` is the single `@ControllerAdvice` that catches these, resolves the key through Spring's `MessageSource` against the request locale, and returns a standardized `ErrorDto` JSON body. Auth failures (401/403) go through the security-specific equivalents, `UserAuthenticationEntryPoint` and `CustomAccessDeniedHandler`, which do the same message-key resolution.

Message bundles are split per domain: `resources/messages/{app,auth,item,security,user}/messages_{en,fr}.properties`. When adding a new exception, add message keys to the matching domain bundle in both languages rather than inlining a string. Locale is resolved by `config/LocaleConfig` (default `fr-FR`, overridable via a `lang` query param).

### Frontend: feature-based structure

`frontend/src/features/<name>/` groups everything for a feature: `index.jsx` (entry component), `ui/` (subviews), `api/` (HTTP calls), `locales/{en,fr}/<name>.json` (i18n namespace), and optionally `mocks/`. `frontend/src/common/` holds cross-feature layouts (`MainLayout`), reusable UI (`ui/`), hooks, and utils (`useLocalStorage`, `Redirect`, `fileUtils`).

Routing is centralized in `src/index.js` (React Router v7), nested under `MainLayout` except for standalone routes like `/testAPI`. `i18n.js` auto-discovers **every** `locales/<lang>/<namespace>.json` file across `common/` and `features/**` via `require.context` — dropping a new `locales/en/foo.json` + `locales/fr/foo.json` pair under a feature is enough to register a new i18n namespace, no manual wiring needed.

State: `zustand` is used for feature-local stores (e.g. `features/auth/authStore.jsx` holds the authenticated user/tokens). No global app-wide store — keep new stores scoped to their feature.

The dev server proxies `/auth`, `/users`, `/tests` requests to `BACKEND_API_URL` (`webpack.config.js`) — when adding a new backend module with its own top-level path, add it to that proxy `context` array or frontend API calls will hit webpack-dev-server instead of the backend.

## Notes

- Both `README.md`s (root, `backend/`, `frontend/`) contain more detailed one-time setup instructions (prerequisites, Docker walkthroughs, Azure OAuth2 sequence diagrams) — consult them for environment setup questions.
- `doc/process-documentation.md` has an in-depth, kept-up-to-date module-by-module reference with class/sequence diagrams for the backend; check it before making non-trivial backend architecture changes.
- Backend REST API docs are auto-generated from tests via Spring REST Docs + Asciidoctor (`mvn package`), output to `backend/target/generated-snippets-html` / `backend/docs`.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import ch.sectioninformatique.template.auth.AuthExceptions.UserNotFoundException;
import ch.sectioninformatique.template.security.SecurityExceptions.InvalidRefreshTokenException;
import ch.sectioninformatique.template.user.UserExceptions.UserDeletionException;
import ch.sectioninformatique.template.user.UserExceptions.UserUpdateException;
import ch.sectioninformatique.template.user.UserDto;
import jakarta.validation.Valid;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -352,6 +353,7 @@ public Mono<ResponseEntity<Map<String, String>>> deleteGlobalUser(String token,
*
* @param token The access token
* @param userId The ID of the user to delete permanently
* @param hardDelete A boolean for soft or hard delete (default: false)
* @return A Mono<ResponseEntity<MessageResponseDto>> containing the permanent
* deletion response (e.g., token or status message)
*/
Expand Down Expand Up @@ -597,4 +599,25 @@ public Mono<ResponseEntity<UserDto>> getTokenWithAuthCode(AuthCodeDto authCodeDt
});
});
}

/**
* Method for updating users
* @param token the access token
* @param login the user's email
* @param userDto the user's DTO
*/

public Mono<ResponseEntity<String>> updateUser(String token, String login, UserDto userDto){
return webClient.put()
.uri(uriWithOptionalLang("/users/" + login))
.header(HttpHeaders.AUTHORIZATION, token)
.bodyValue(userDto)
.retrieve()
.onStatus(status -> status.value() >= 400,
response -> response.bodyToMono(ErrorDto.class)
.flatMap(error -> Mono.error(new UserUpdateException(error.message()))))

.toEntity(String.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import ch.sectioninformatique.template.user.User;
import ch.sectioninformatique.template.user.UserDto;
import ch.sectioninformatique.template.user.UserMapper;
import ch.sectioninformatique.template.user.UserService;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import jakarta.validation.Valid;
Expand All @@ -49,6 +52,9 @@ public class AuthController {
/** Client to send authentication requests to the spring-auth application */
private final AuthClient authClient;

/** Mapper for converting between User entities and DTOs */
private final UserMapper userMapper;

// Logger for debugging and monitoring the authentication flow.
private static final Logger log = LoggerFactory.getLogger(AuthController.class);

Expand Down Expand Up @@ -98,10 +104,11 @@ public ResponseEntity<UserDto> register(@RequestHeader("Authorization") String t
return authClient.register(token, user)
.flatMap(response -> {
// On successful registration, also register user locally
userService.register(user);
User localUser = userService.register(user);
UserDto localUserDto = userMapper.toUserDto(localUser);

// Return HTTP 200 OK with the response body
return Mono.just(response);
// Return HTTP 200 OK with the locally registered user
return Mono.just(ResponseEntity.status(response.getStatusCode()).body(localUserDto));
})
.block();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package ch.sectioninformatique.template.auth;

import java.util.List;

/**
* Data transfer object for user registration.
* This record class holds the information required to create a new user
* account.
*
* @param firstName The user's first name
* @param lastName The user's last name
* @param login The user's login identifier
* @param password The user's password as a character array
* @param firstName The user's first name
* @param lastName The user's last name
* @param login The user's login identifier
* @param password The user's password as a character array
* @param mainRole The user's main role
* @param appSpecificRoles The user's appSpecificRoles
*/
public record RegisterDto(String firstName, String lastName, String login, char[] password) {}
public record RegisterDto(String firstName, String lastName, String login, char[] password, String mainRole , List<String> appSpecificRoles ) {}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package ch.sectioninformatique.template.item;

import ch.sectioninformatique.template.user.User;

import java.util.Date;

import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.ParamDef;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.UpdateTimestamp;

import ch.sectioninformatique.template.user.User;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
Expand All @@ -19,6 +19,7 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;

import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
Expand All @@ -34,8 +35,6 @@
@Builder
@NoArgsConstructor
@SQLDelete(sql = "UPDATE items SET deleted = true WHERE id = ?")
@FilterDef(name = "delete", parameters = @ParamDef(name = "deleted", type = Boolean.class))
@Filter(name = "delete", condition = "deleted = :deleted")
public class Item {

/**
Expand All @@ -62,7 +61,8 @@ public class Item {
* Uses eager fetching to ensure author information is always available.
*/
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "author_id")
@OnDelete(action = OnDeleteAction.SET_NULL)
@JoinColumn(name = "author_id", nullable = true)
private User author;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
@SuppressWarnings("null")
public interface ItemRepository extends CrudRepository<Item, Long> {

/**
* Finds all items that are not soft deleted.
*
* @return a list of non-deleted items
*/
List<Item> findAllByDeletedFalse();

/**
* Finds all items, including soft deleted ones.
*
Expand All @@ -42,4 +49,12 @@ public interface ItemRepository extends CrudRepository<Item, Long> {
@Transactional
@Query("DELETE FROM Item i WHERE i.id = :id")
void deletePermanentlyById(Long id);

/**
* Deletes all items permantently.
*/
@Modifying
@Transactional
@Query("DELETE FROM Item")
void deleteAllPermanently();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import jakarta.persistence.EntityManager;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import org.hibernate.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -107,22 +105,26 @@ public Optional<Item> getItem(final Long id) {
return itemRepository.findById(id);
}

/**
* By default, getItems method returns only non-deleted items.
*
* @return A List containing all non-deleted items
*/
public List<Item> getItems() {
return getItems(false);
}

/**
* Retrieves all items in the system.
*
* @return An Iterable containing all items
* @param includeDeleted Whether to include soft-deleted items
* @return A List containing all items including or not soft-deleted ones
*/
public Iterable<Item> getItems(boolean includeDeleted)
{
Session session = entityManager.unwrap(Session.class);
if(includeDeleted) {
session.disableFilter("delete");
} else {
session.enableFilter("delete").setParameter("deleted", false);
public List<Item> getItems(boolean includeDeleted) {
if (includeDeleted) {
return itemRepository.findAllIncludingDeleted();
}
List<Item> items = new ArrayList<>();
itemRepository.findAll().forEach(items::add);
return items;
return itemRepository.findAllByDeletedFalse();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package ch.sectioninformatique.template.security;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
@RequestMapping("/roles")
public class RoleController {
private final RoleService roleService;

RoleController(RoleService roleService) {
this.roleService = roleService;
}

/**
* Retrieves all roles in the system.
*
* @return A ResponseEntity containing the list of all roles
*/
@GetMapping("/all")
public ResponseEntity<?> getRoles() {
return ResponseEntity.ok().body(roleService.getAllRoles());
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ch.sectioninformatique.template.security;

import java.util.Optional;

import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
* Repository interface for Role entity operations.
* This interface:
Expand Down
Loading