Class DokkuController

java.lang.Object
edu.ucsb.cs156.frontiers.controllers.ApiController
edu.ucsb.cs156.frontiers.controllers.DokkuController

@RequestMapping("/api/dokku") @RestController public class DokkuController extends ApiController
Endpoints that produce files for setting up access to the UCSB Dokku servers (dokku-00 through dokku-18).
  • Field Details

    • LOWEST_DOKKU_NUMBER

      public static final int LOWEST_DOKKU_NUMBER
      The lowest numbered dokku instance, i.e. dokku-00.
      See Also:
    • HIGHEST_DOKKU_NUMBER

      public static final int HIGHEST_DOKKU_NUMBER
      The highest numbered dokku instance, i.e. dokku-18.
      See Also:
  • Constructor Details

    • DokkuController

      public DokkuController()
  • Method Details

    • allDokkuNames

      public static Collection<String> allDokkuNames()
      Returns every dokku instance name in order, dokku-00 through dokku-18.
      Returns:
      the dokku instance names
    • usernameFromEmail

      public static String usernameFromEmail(String email)
      Extracts the dokku username from an email address: everything before the first @. An email with no @ is returned unchanged.
      Parameters:
      email - the email address
      Returns:
      the username
    • usernameFor

      public static String usernameFor(String email, Map<String,String> translations)
      Returns the dokku username for an email: the translated username if there is a DokkuAccountTranslation for the email (compared in canonical form), otherwise the part of the email before the @.
      Parameters:
      email - the email address
      translations - map from canonical email to dokku username
      Returns:
      the dokku username
    • dokkuNameForTeam

      public static Optional<String> dokkuNameForTeam(String teamName)
      Returns the dokku instance named by a team, if the team name has the form xxx-yy and yy is between LOWEST_DOKKU_NUMBER and HIGHEST_DOKKU_NUMBER inclusive.
      Parameters:
      teamName - the team name, e.g. "s26-07"
      Returns:
      the dokku instance name, e.g. "dokku-07", or empty if the team does not correspond to a dokku instance
    • dokkuUsersList

      @GetMapping(value="/dokku_users_list", produces="text/csv") @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") public org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody> dokkuUsersList(@RequestParam Long courseId) throws EntityNotFoundException
      Throws:
      EntityNotFoundException
    • getUsersListHeader

      @GetMapping(value="/users_list_header", produces="text/plain") @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") public String getUsersListHeader(@RequestParam Long courseId) throws EntityNotFoundException
      Throws:
      EntityNotFoundException
    • setUsersListHeader

      @PutMapping(value="/users_list_header", consumes="text/plain", produces="text/plain") @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") public String setUsersListHeader(@RequestParam Long courseId, @RequestBody(required=false) String header) throws EntityNotFoundException
      Throws:
      EntityNotFoundException