Package se.bth.pulse.controller
Class UserAdminController
java.lang.Object
se.bth.pulse.controller.UserAdminController
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 TypeMethodDescriptiondisableUser
(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.
-
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 viewauthentication
- - 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 editedmodel
- - used to pass attributes to the viewauthentication
- - 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 disabledmodel
- - used to pass attributes to the viewauthentication
- - used to get the username and role of the logged-in user- Returns:
- String - the view to be rendered
-