Class AdminControllerImpl

All Implemented Interfaces:
AdminController

@Controller("mvc.adminUI") @PreAuthorize("hasRole(\'ADMIN\')") public class AdminControllerImpl extends DatabaseAwareBean implements AdminController
Implements the logic supporting the JSP views and maps them into URL space.
Author:
Donal Fellows
  • Constructor Details

    • AdminControllerImpl

      public AdminControllerImpl()
  • Method Details

    • mainUI

      public ModelAndView mainUI(ModelMap ignored)
      Description copied from interface: AdminController
      Get supported ops.
      Specified by:
      mainUI in interface AdminController
      Parameters:
      ignored - Overall model
      Returns:
      the view
    • listUsers

      public ModelAndView listUsers(ModelMap ignored)
      Description copied from interface: AdminController
      List all users.
      Specified by:
      listUsers in interface AdminController
      Parameters:
      ignored - Overall model
      Returns:
      the model and view
    • getUserCreationForm

      public ModelAndView getUserCreationForm(ModelMap ignored)
      Description copied from interface: AdminController
      Get the form for creating a user.
      Specified by:
      getUserCreationForm in interface AdminController
      Parameters:
      ignored - Overall model
      Returns:
      the model and view
    • createUser

      public ModelAndView createUser(UserRecord user, ModelMap model, RedirectAttributes attrs)
      Description copied from interface: AdminController
      Create a user.
      Specified by:
      createUser in interface AdminController
      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

      public ModelAndView showUserForm(int id)
      Description copied from interface: AdminController
      Show user details.
      Specified by:
      showUserForm in interface AdminController
      Parameters:
      id - The user ID
      Returns:
      the model and view
    • submitUserForm

      public ModelAndView submitUserForm(int id, UserRecord user, ModelMap model, Principal principal)
      Description copied from interface: AdminController
      Modify user details.
      Specified by:
      submitUserForm in interface AdminController
      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

      public ModelAndView deleteUser(int id, Principal principal, RedirectAttributes attrs)
      Description copied from interface: AdminController
      Delete a user.
      Specified by:
      deleteUser in interface AdminController
      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

      public ModelAndView listGroups(ModelMap ignored)
      Description copied from interface: AdminController
      List all groups.
      Specified by:
      listGroups in interface AdminController
      Parameters:
      ignored - Overall model
      Returns:
      the model and view
    • showGroupInfo

      public ModelAndView showGroupInfo(int id)
      Description copied from interface: AdminController
      Get info about a particular group.
      Specified by:
      showGroupInfo in interface AdminController
      Parameters:
      id - The ID of the group to get info about.
      Returns:
      the model and view
    • getGroupCreationForm

      public ModelAndView getGroupCreationForm(ModelMap ignored)
      Description copied from interface: AdminController
      Get the form for creating a group.
      Specified by:
      getGroupCreationForm in interface AdminController
      Parameters:
      ignored - Overall model
      Returns:
      the model (a AdminController.CreateGroupModel) and view
    • createGroup

      public ModelAndView createGroup(AdminController.CreateGroupModel groupRequest, RedirectAttributes attrs)
      Description copied from interface: AdminController
      Create a group.
      Specified by:
      createGroup in interface AdminController
      Parameters:
      groupRequest - 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

      public ModelAndView addUserToGroup(int id, String user, RedirectAttributes attrs)
      Description copied from interface: AdminController
      Add a user to a group.
      Specified by:
      addUserToGroup in interface AdminController
      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

      public ModelAndView removeUserFromGroup(int id, int userid, RedirectAttributes attrs)
      Description copied from interface: AdminController
      Remove a user from a group.
      Specified by:
      removeUserFromGroup in interface AdminController
      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

      public ModelAndView adjustGroupQuota(int id, int delta, RedirectAttributes attrs)
      Description copied from interface: AdminController
      Adjust the quota of a group.
      Specified by:
      adjustGroupQuota in interface AdminController
      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

      public ModelAndView deleteGroup(int id, RedirectAttributes attrs)
      Description copied from interface: AdminController
      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.
      Specified by:
      deleteGroup in interface AdminController
      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

      public ModelAndView boards(ModelMap ignored)
      Description copied from interface: AdminController
      UI for boards.
      Specified by:
      boards in interface AdminController
      Parameters:
      ignored - Overall model
      Returns:
      the model and view
    • board

      public ModelAndView board(BoardRecord board, ModelMap model)
      Description copied from interface: AdminController
      Manipulate a board.
      Specified by:
      board in interface AdminController
      Parameters:
      board - The board coordinates, and possibly the state change
      model - Overall model
      Returns:
      the model and view
    • blacklistSave

      public ResponseEntity<Void> blacklistSave(AdminController.BlacklistData bldata)
      Description copied from interface: AdminController
      Save a new blacklist.
      Specified by:
      blacklistSave in interface AdminController
      Parameters:
      bldata - The blacklist data.
      Returns:
      The empty response with the appropriate code.
    • blacklistFetch

      public AdminController.BlacklistData blacklistFetch(int boardId, int bmpId)
      Description copied from interface: AdminController
      Fetch the blacklist for a board from the machine.
      Specified by:
      blacklistFetch in interface AdminController
      Parameters:
      boardId - The board to get the data for.
      bmpId - The BMP of the board.
      Returns:
      the blacklist data.
    • getTemperatures

      public BoardTemperatures getTemperatures(int boardId, int bmpId)
      Description copied from interface: AdminController
      Get the temperature data for a board.
      Specified by:
      getTemperatures in interface AdminController
      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

      public ModelAndView machineManagement(ModelMap ignored)
      Provide the form for uploading a machine definition.

      Implementation note: This is the baseline information that admin/machine.jsp needs.

      Specified by:
      machineManagement in interface AdminController
      Parameters:
      ignored - Overall model
      Returns:
      the model and view
    • retagMachine

      public ModelAndView retagMachine(String machineName, String newTags)
      Description copied from interface: AdminController
      Handle the change of the tags of a machine.
      Specified by:
      retagMachine in interface AdminController
      Parameters:
      machineName - The name of the machine being retagged
      newTags - The tags of the machine; comma-separated list
      Returns:
      the model and view
    • disableMachine

      public ModelAndView disableMachine(String machineName)
      Description copied from interface: AdminController
      Mark a machine as out of service.
      Specified by:
      disableMachine in interface AdminController
      Parameters:
      machineName - The name of the machine being disabled
      Returns:
      the model and view
    • enableMachine

      public ModelAndView enableMachine(String machineName)
      Description copied from interface: AdminController
      Mark a machine as in service.
      Specified by:
      enableMachine in interface AdminController
      Parameters:
      machineName - The name of the machine being enabled
      Returns:
      the model and view
    • defineMachine

      public ModelAndView defineMachine(MultipartFile file)
      Description copied from interface: AdminController
      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.
      Specified by:
      defineMachine in interface AdminController
      Parameters:
      file - The file being uploaded
      Returns:
      the model and view