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 Classes Modifier and Type Interface Description static class
AdminController.BlacklistData
The model of a blacklist used by the administration web interface.static class
AdminController.CreateGroupModel
Model used when creating a group. -
Field Summary
Fields Modifier and Type Field Description static String
BASE_PATH
The base path of this interface within the MVC domain.static String
BLACKLIST_PATH
Path to blacklist operations.static String
BOARDS_PATH
Path to boards operations.static String
CREATE_GROUP_PATH
Path to group creation operations.static String
CREATE_USER_PATH
Path to user creation operations.static String
GROUP_ADD_USER_PATH
Path to user-add-to-group operation.static String
GROUP_DELETE_PATH
Path to single-user-deletion operation.static String
GROUP_PATH
Path to single-group operations.static String
GROUP_QUOTA_PATH
Path to quota-adjustment operation.static String
GROUP_REMOVE_USER_PATH
Path to user-remove-from-group operation.static String
GROUPS_PATH
Path to all-groups operations.static String
MACHINE_FILE_PARAM
Name of parameter used when submitting a new machine definition.static String
MACHINE_PATH
Path to machine-instantiation operations.static String
MACHINE_RETAG_PARAM
Name of parameter used to mark a retagging.static String
TEMPERATURE_PATH
Path to temperature operations.static String
USER_DELETE_PATH
Path to single-user-deletion operation.static String
USER_PATH
Path to single-user operations.static String
USERS_PATH
Path to all-users operations. -
Method Summary
Modifier and Type Method Description ModelAndView
addUserToGroup(int id, @NotBlank String user, RedirectAttributes attrs)
Add a user to a group.ModelAndView
adjustGroupQuota(int id, int delta, RedirectAttributes attrs)
Adjust the quota of a group.AdminController.BlacklistData
blacklistFetch(@javax.validation.Valid int boardId, @javax.validation.Valid int bmpId)
Fetch the blacklist for a board from the machine.ResponseEntity<Void>
blacklistSave(@Valid AdminController.BlacklistData bldata)
Save a new blacklist.ModelAndView
board(@Valid BoardRecord board, ModelMap model)
Manipulate a board.ModelAndView
boards(ModelMap model)
UI for boards.ModelAndView
createGroup(@Valid AdminController.CreateGroupModel group, RedirectAttributes attrs)
Create a group.ModelAndView
createUser(@Valid UserRecord user, ModelMap model, RedirectAttributes attrs)
Create a user.ModelAndView
defineMachine(@NotNull MultipartFile file)
Handle the upload of a machine definition.ModelAndView
deleteGroup(int id, RedirectAttributes attrs)
Delete a group.ModelAndView
deleteUser(int id, Principal principal, RedirectAttributes attrs)
Delete a user.ModelAndView
disableMachine(@NotEmpty String machineName)
Mark a machine as out of service.ModelAndView
enableMachine(@NotEmpty String machineName)
Mark a machine as in service.ModelAndView
getGroupCreationForm(ModelMap model)
Get the form for creating a group.BoardTemperatures
getTemperatures(@javax.validation.Valid int boardId, @javax.validation.Valid int bmpId)
Get the temperature data for a board.ModelAndView
getUserCreationForm(ModelMap model)
Get the form for creating a user.ModelAndView
listGroups(ModelMap model)
List all groups.ModelAndView
listUsers(ModelMap model)
List all users.ModelAndView
machineManagement(ModelMap model)
Provide the form for uploading a machine definition.ModelAndView
mainUI(ModelMap model)
Get supported ops.ModelAndView
removeUserFromGroup(int id, int userid, RedirectAttributes attrs)
Remove a user from a group.ModelAndView
retagMachine(@NotEmpty String machineName, @TagList @NotNull String newTags)
Handle the change of the tags of a machine.ModelAndView
showGroupInfo(int id)
Get info about a particular group.ModelAndView
showUserForm(int id)
Show user details.ModelAndView
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:
- Constant Field Values
-
USERS_PATH
Path to all-users operations.- See Also:
- Constant Field Values
-
CREATE_USER_PATH
Path to user creation operations.- See Also:
- Constant Field Values
-
USER_PATH
Path to single-user operations.- See Also:
- Constant Field Values
-
USER_DELETE_PATH
Path to single-user-deletion operation.- See Also:
- Constant Field Values
-
GROUPS_PATH
Path to all-groups operations.- See Also:
- Constant Field Values
-
CREATE_GROUP_PATH
Path to group creation operations.- See Also:
- Constant Field Values
-
GROUP_PATH
Path to single-group operations.- See Also:
- Constant Field Values
-
GROUP_ADD_USER_PATH
Path to user-add-to-group operation.- See Also:
- Constant Field Values
-
GROUP_REMOVE_USER_PATH
Path to user-remove-from-group operation.- See Also:
- Constant Field Values
-
GROUP_QUOTA_PATH
Path to quota-adjustment operation.- See Also:
- Constant Field Values
-
GROUP_DELETE_PATH
Path to single-user-deletion operation.- See Also:
- Constant Field Values
-
BOARDS_PATH
Path to boards operations.- See Also:
- Constant Field Values
-
BLACKLIST_PATH
Path to blacklist operations.- See Also:
- Constant Field Values
-
TEMPERATURE_PATH
Path to temperature operations.- See Also:
- Constant Field Values
-
MACHINE_PATH
Path to machine-instantiation operations.- See Also:
- Constant Field Values
-
MACHINE_FILE_PARAM
Name of parameter used when submitting a new machine definition.- See Also:
- Constant Field Values
-
MACHINE_RETAG_PARAM
Name of parameter used to mark a retagging.- See Also:
- Constant Field Values
-
-
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") @javax.validation.Valid int boardId, @Valid @RequestParam("bmp_id") @javax.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") @javax.validation.Valid int boardId, @Valid @RequestParam("bmp_id") @javax.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
-