Interface AdminController
- All Known Implementing Classes:
AdminControllerImpl
@RequestMapping("/system/admin")
@PreAuthorize("hasRole(\'ADMIN\')")
public interface AdminController
The API for the controller for the admin user interface.
- Author:
- Donal Fellows
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
The model of a blacklist used by the administration web interface.static class
Model used when creating a group. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The base path of this interface within the MVC domain.static final String
Path to blacklist operations.static final String
Path to boards operations.static final String
Path to group creation operations.static final String
Path to user creation operations.static final String
Path to user-add-to-group operation.static final String
Path to single-user-deletion operation.static final String
Path to single-group operations.static final String
Path to quota-adjustment operation.static final String
Path to user-remove-from-group operation.static final String
Path to all-groups operations.static final String
Name of parameter used when submitting a new machine definition.static final String
Path to machine-instantiation operations.static final String
Name of parameter used to mark a retagging.static final String
Path to temperature operations.static final String
Path to single-user-deletion operation.static final String
Path to single-user operations.static final String
Path to all-users operations. -
Method Summary
Modifier and TypeMethodDescriptionaddUserToGroup
(int id, @NotBlank String user, RedirectAttributes attrs) Add a user to a group.adjustGroupQuota
(int id, int delta, RedirectAttributes attrs) Adjust the quota of a group.blacklistFetch
(@jakarta.validation.Valid int boardId, @jakarta.validation.Valid int bmpId) Fetch the blacklist for a board from the machine.blacklistSave
(@Valid AdminController.BlacklistData bldata) Save a new blacklist.board
(@Valid BoardRecord board, ModelMap model) Manipulate a board.UI for boards.createGroup
(@Valid AdminController.CreateGroupModel group, RedirectAttributes attrs) Create a group.createUser
(@Valid UserRecord user, ModelMap model, RedirectAttributes attrs) Create a user.defineMachine
(@NotNull MultipartFile file) Handle the upload of a machine definition.deleteGroup
(int id, RedirectAttributes attrs) Delete a group.deleteUser
(int id, Principal principal, RedirectAttributes attrs) Delete a user.disableMachine
(@NotEmpty String machineName) Mark a machine as out of service.enableMachine
(@NotEmpty String machineName) Mark a machine as in service.getGroupCreationForm
(ModelMap model) Get the form for creating a group.getTemperatures
(@jakarta.validation.Valid int boardId, @jakarta.validation.Valid int bmpId) Get the temperature data for a board.getUserCreationForm
(ModelMap model) Get the form for creating a user.listGroups
(ModelMap model) List all groups.List all users.machineManagement
(ModelMap model) Provide the form for uploading a machine definition.Get supported ops.removeUserFromGroup
(int id, int userid, RedirectAttributes attrs) Remove a user from a group.retagMachine
(@NotEmpty String machineName, @TagList @NotNull String newTags) Handle the change of the tags of a machine.showGroupInfo
(int id) Get info about a particular group.showUserForm
(int id) Show user details.submitUserForm
(int id, @Valid UserRecord user, ModelMap model, Principal principal) Modify user details.
-
Field Details
-
BASE_PATH
The base path of this interface within the MVC domain.- See Also:
-
USERS_PATH
Path to all-users operations.- See Also:
-
CREATE_USER_PATH
Path to user creation operations.- See Also:
-
USER_PATH
Path to single-user operations.- See Also:
-
USER_DELETE_PATH
Path to single-user-deletion operation.- See Also:
-
GROUPS_PATH
Path to all-groups operations.- See Also:
-
CREATE_GROUP_PATH
Path to group creation operations.- See Also:
-
GROUP_PATH
Path to single-group operations.- See Also:
-
GROUP_ADD_USER_PATH
Path to user-add-to-group operation.- See Also:
-
GROUP_REMOVE_USER_PATH
Path to user-remove-from-group operation.- See Also:
-
GROUP_QUOTA_PATH
Path to quota-adjustment operation.- See Also:
-
GROUP_DELETE_PATH
Path to single-user-deletion operation.- See Also:
-
BOARDS_PATH
Path to boards operations.- See Also:
-
BLACKLIST_PATH
Path to blacklist operations.- See Also:
-
TEMPERATURE_PATH
Path to temperature operations.- See Also:
-
MACHINE_PATH
Path to machine-instantiation operations.- See Also:
-
MACHINE_FILE_PARAM
Name of parameter used when submitting a new machine definition.- See Also:
-
MACHINE_RETAG_PARAM
Name of parameter used to mark a retagging.- See Also:
-
-
Method Details
-
mainUI
Get supported ops.- Parameters:
model
- Overall model- Returns:
- the view
-
listUsers
List all users.- Parameters:
model
- Overall model- Returns:
- the model and view
-
getUserCreationForm
Get the form for creating a user.- Parameters:
model
- Overall model- Returns:
- the model and view
-
createUser
@PostMapping("/create-user") ModelAndView createUser(@Valid @ModelAttribute("user") @Valid UserRecord user, ModelMap model, RedirectAttributes attrs) Create a user.- Parameters:
user
- The description of the user to createmodel
- Overall modelattrs
- Where to put attributes of the model so that they are respected after the redirect without being present in the URL.- Returns:
- the model and view
-
showUserForm
Show user details.- Parameters:
id
- The user ID- Returns:
- the model and view
-
submitUserForm
@PostMapping("/users/{id}") ModelAndView submitUserForm(@PathVariable("id") int id, @Valid @ModelAttribute("user") @Valid UserRecord user, ModelMap model, Principal principal) Modify user details.- Parameters:
id
- The user IDuser
- The description of the user to updatemodel
- Overall modelprincipal
- Who is the admin? Used for safety checks.- Returns:
- the model and view
-
deleteUser
@PostMapping("/users/{id}/delete") ModelAndView deleteUser(@PathVariable("id") int id, Principal principal, RedirectAttributes attrs) Delete a user.- Parameters:
id
- The user ID to deleteprincipal
- Who is the admin? Used for safety checks.attrs
- Where to put attributes of the model so that they are respected after the redirect without being present in the URL.- Returns:
- the model and view
-
listGroups
List all groups.- Parameters:
model
- Overall model- Returns:
- the model and view
-
showGroupInfo
Get info about a particular group.- Parameters:
id
- The ID of the group to get info about.- Returns:
- the model and view
-
getGroupCreationForm
Get the form for creating a group.- Parameters:
model
- Overall model- Returns:
- the model (a
AdminController.CreateGroupModel
) and view
-
createGroup
@PostMapping("/create-group") ModelAndView createGroup(@Valid @ModelAttribute("group") @Valid AdminController.CreateGroupModel group, RedirectAttributes attrs) Create a group.- Parameters:
group
- The description of the group to createattrs
- Where to put attributes of the model so that they are respected after the redirect without being present in the URL.- Returns:
- the model and view
-
addUserToGroup
@PostMapping("/groups/{id}/add-user") ModelAndView addUserToGroup(@PathVariable("id") int id, @NotBlank @RequestParam("user") @NotBlank String user, RedirectAttributes attrs) Add a user to a group.- Parameters:
id
- The group ID to adjustuser
- The name of the user to addattrs
- Where to put attributes of the model so that they are respected after the redirect without being present in the URL.- Returns:
- the model and view
-
removeUserFromGroup
@PostMapping("/groups/{id}/remove-user/{userid}") ModelAndView removeUserFromGroup(@PathVariable("id") int id, @PathVariable("userid") int userid, RedirectAttributes attrs) Remove a user from a group.- Parameters:
id
- The group ID to adjustuserid
- The ID of the user to removeattrs
- Where to put attributes of the model so that they are respected after the redirect without being present in the URL.- Returns:
- the model and view
-
adjustGroupQuota
@PostMapping("/groups/{id}/adjust-quota") ModelAndView adjustGroupQuota(@PathVariable("id") int id, @RequestParam("delta") int delta, RedirectAttributes attrs) Adjust the quota of a group.- Parameters:
id
- The group ID to adjustdelta
- By how much are we to adjust the quota. In board-hours.attrs
- Where to put attributes of the model so that they are respected after the redirect without being present in the URL.- Returns:
- the model and view
-
deleteGroup
@PostMapping("/groups/{id}/delete") ModelAndView deleteGroup(@PathVariable("id") int id, RedirectAttributes attrs) Delete a group. It is legal for a user to not be a member of any group; they just won't be able to submit jobs if that's the case.- Parameters:
id
- The group ID to deleteattrs
- Where to put attributes of the model so that they are respected after the redirect without being present in the URL.- Returns:
- the model and view
-
boards
UI for boards.- Parameters:
model
- Overall model- Returns:
- the model and view
-
board
@PostMapping("/boards") ModelAndView board(@Valid @ModelAttribute("board") @Valid BoardRecord board, ModelMap model) Manipulate a board.- Parameters:
board
- The board coordinates, and possibly the state changemodel
- Overall model- Returns:
- the model and view
-
blacklistSave
@PostMapping("/boards/blacklist") ResponseEntity<Void> blacklistSave(@Valid @RequestBody @Valid AdminController.BlacklistData bldata) Save a new blacklist.- Parameters:
bldata
- The blacklist data.- Returns:
- The empty response with the appropriate code.
-
blacklistFetch
@GetMapping("/boards/blacklist") @ResponseBody AdminController.BlacklistData blacklistFetch(@Valid @RequestParam("board_id") @jakarta.validation.Valid int boardId, @Valid @RequestParam("bmp_id") @jakarta.validation.Valid int bmpId) Fetch the blacklist for a board from the machine.- Parameters:
boardId
- The board to get the data for.bmpId
- The BMP of the board.- Returns:
- the blacklist data.
-
getTemperatures
@GetMapping("/boards/temperature") @ResponseBody BoardTemperatures getTemperatures(@Valid @RequestParam("board_id") @jakarta.validation.Valid int boardId, @Valid @RequestParam("bmp_id") @jakarta.validation.Valid int bmpId) Get the temperature data for a board.- Parameters:
boardId
- Which board to get the data for.bmpId
- The BMP that controls the board.- Returns:
- the model and view in a future
-
machineManagement
Provide the form for uploading a machine definition.- Parameters:
model
- Overall model- Returns:
- the model and view
-
retagMachine
@PostMapping(path="/machine", params="retag") ModelAndView retagMachine(@NotEmpty @ModelAttribute("machine") @NotEmpty String machineName, @TagList @NotNull @ModelAttribute("retag") @TagList @NotNull String newTags) Handle the change of the tags of a machine.- Parameters:
machineName
- The name of the machine being retaggednewTags
- The tags of the machine; comma-separated list- Returns:
- the model and view
-
disableMachine
@PostMapping(value="/machine", params="outOfService") ModelAndView disableMachine(@NotEmpty @ModelAttribute("machine") @NotEmpty String machineName) Mark a machine as out of service.- Parameters:
machineName
- The name of the machine being disabled- Returns:
- the model and view
-
enableMachine
@PostMapping(value="/machine", params="intoService") ModelAndView enableMachine(@NotEmpty @ModelAttribute("machine") @NotEmpty String machineName) Mark a machine as in service.- Parameters:
machineName
- The name of the machine being enabled- Returns:
- the model and view
-
defineMachine
@PostMapping(path="/machine") ModelAndView defineMachine(@NotNull @RequestParam("file") @NotNull MultipartFile file) Handle the upload of a machine definition. Note that no user has any quota set on a newly defined machine; it's totally free to use by default.- Parameters:
file
- The file being uploaded- Returns:
- the model and view
-