Class AdminController

java.lang.Object
fr.utc.miage.sporttrack.controller.AdminController

@Controller @RequestMapping("/admin") public class AdminController extends Object
Spring MVC controller for the administrator home page.

Checks that the current user has admin privileges before granting access to the admin dashboard.

Author:
SportTrack Team
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an AdminController with the required service.
  • Method Summary

    Modifier and Type
    Method
    Description
    home(org.springframework.ui.Model model, org.springframework.security.core.Authentication auth)
    Renders the admin home page if the current user is an authenticated admin.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AdminController

      public AdminController(AdminService adminService)
      Constructs an AdminController with the required service.
      Parameters:
      adminService - the admin service for authentication checks
  • Method Details

    • home

      @GetMapping("") public String home(org.springframework.ui.Model model, org.springframework.security.core.Authentication auth)
      Renders the admin home page if the current user is an authenticated admin.
      Parameters:
      model - the Spring MVC model
      auth - the current security authentication
      Returns:
      the view name "admin/home", or a redirect to login if not an admin