Début de la page admin

This commit is contained in:
jleroy
2024-04-25 16:58:47 +02:00
parent 85f4f52960
commit 658f1c3e9c
7 changed files with 108 additions and 4 deletions

View File

@@ -2,6 +2,12 @@ package fr.eni.enchere.controllers;
import fr.eni.enchere.bll.CategorieService;
import fr.eni.enchere.bll.UserService;
import fr.eni.enchere.bo.Article;
import fr.eni.enchere.bo.Retrait;
import fr.eni.enchere.bo.UserProfil;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -20,7 +26,21 @@ public class AdminController {
@GetMapping( "/admin")
public String viewAdminPanel(Model model) {
model.addAttribute("categories", categorieService.findAllCategories());
//model.addAttribute("userProfil", userService.f);
model.addAttribute("userProfil", userService.listeUtilisateurs());
return "admin";
}
// @GetMapping("/admin")
// public String newArticleForm(HttpServletRequest request, Model model) {
// model.addAttribute("categories", categorieService.findAllCategories());
// model.addAttribute("article", new Article());
// model.addAttribute("retrait", new Retrait());
// model.addAttribute("requestURI", request.getRequestURI());
// //Récupérer l'utilisateur pour set le retrait à son adresse par defaut
// Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
// String username = authentication.getName();
// UserProfil userProfile = userService.utilisateurByName(username);
// model.addAttribute("user", userProfile);
// return "admin";
// }
}