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
  • Field Details

  • Method Details

    • mainUI

      @GetMapping("/") ModelAndView mainUI(ModelMap model)
      Get supported ops.
      Parameters:
      model - Overall model
      Returns:
      the view
    • listUsers

      @GetMapping("/users") ModelAndView listUsers(ModelMap model)
      List all users.
      Parameters:
      model - Overall model
      Returns:
      the model and view
    • getUserCreationForm

      @GetMapping("/create-user") ModelAndView getUserCreationForm(ModelMap model)
      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 create
      model - Overall model
      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
    • showUserForm

      @GetMapping("/users/{id}") ModelAndView showUserForm(@PathVariable("id") int id)
      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 ID
      user - The description of the user to update
      model - Overall model
      principal - 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 delete
      principal - 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

      @GetMapping("/groups") ModelAndView listGroups(ModelMap model)
      List all groups.
      Parameters:
      model - Overall model
      Returns:
      the model and view
    • showGroupInfo

      @GetMapping("/groups/{id}") ModelAndView showGroupInfo(@PathVariable("id") int id)
      Get info about a particular group.
      Parameters:
      id - The ID of the group to get info about.
      Returns:
      the model and view
    • getGroupCreationForm

      @GetMapping("/create-group") ModelAndView getGroupCreationForm(ModelMap model)
      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 create
      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
    • 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 adjust
      user - The name of the user to add
      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
    • 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 adjust
      userid - The ID of the user to remove
      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
    • 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 adjust
      delta - 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 delete
      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
    • boards

      @GetMapping("/boards") ModelAndView boards(ModelMap model)
      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 change
      model - 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

      @GetMapping("/machine") ModelAndView machineManagement(ModelMap model)
      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 retagged
      newTags - 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