Class UserAdminController

java.lang.Object
se.bth.pulse.controller.UserAdminController

@Controller public class UserAdminController extends Object
This class is a view controller that serves the user-admin page. It is only accessible by users with the Role "admin".
  • Method Summary

    Modifier and Type
    Method
    Description
    disableUser(Integer id, org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication)
    Renders the page for disabling users.
    editUser(Integer id, org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication)
    Views the page for editing users.
    showUsers(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication)
    This method is used to render the user-admin page.

    Methods inherited from class java.lang.Object

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

    • showUsers

      @GetMapping("/admin/users") public String showUsers(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication)
      This method is used to render the user-admin page. The return string is the name of the view to be rendered.
      Parameters:
      model - - used to pass attributes to the view
      authentication - - used to get the username and role of the logged-in user
      Returns:
      - the view to be rendered
    • editUser

      @GetMapping("/admin/user/edit/{id}") public String editUser(@PathVariable("id") Integer id, org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication)
      Views the page for editing users.
      Parameters:
      id - - the id of the user to be edited
      model - - used to pass attributes to the view
      authentication - - used to get the username and role of the logged-in user
      Returns:
      String - the view to be rendered
    • disableUser

      @GetMapping("/admin/user/disable/{id}") public String disableUser(@PathVariable("id") Integer id, org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication)
      Renders the page for disabling users. It's mostly a curtsey to the admin so they dont disable the wrong user.
      Parameters:
      id - - the id of the user to be disabled
      model - - used to pass attributes to the view
      authentication - - used to get the username and role of the logged-in user
      Returns:
      String - the view to be rendered