Class DokkuController
java.lang.Object
edu.ucsb.cs156.frontiers.controllers.ApiController
edu.ucsb.cs156.frontiers.controllers.DokkuController
Endpoints that produce files for setting up access to the UCSB Dokku servers (dokku-00 through
dokku-18).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe highest numbered dokku instance, i.e. dokku-18.static final intThe lowest numbered dokku instance, i.e. dokku-00. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<String> Returns every dokku instance name in order,dokku-00throughdokku-18.dokkuNameForTeam(String teamName) Returns the dokku instance named by a team, if the team name has the formxxx-yyandyyis betweenLOWEST_DOKKU_NUMBERandHIGHEST_DOKKU_NUMBERinclusive.org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody> dokkuUsersList(Long courseId) getUsersListHeader(Long courseId) setUsersListHeader(Long courseId, String header) static StringusernameFor(String email, Map<String, String> translations) Returns the dokku username for an email: the translated username if there is aDokkuAccountTranslationfor the email (compared in canonical form), otherwise the part of the email before the@.static StringusernameFromEmail(String email) Extracts the dokku username from an email address: everything before the first@.
-
Field Details
-
LOWEST_DOKKU_NUMBER
public static final int LOWEST_DOKKU_NUMBERThe lowest numbered dokku instance, i.e. dokku-00.- See Also:
-
HIGHEST_DOKKU_NUMBER
public static final int HIGHEST_DOKKU_NUMBERThe highest numbered dokku instance, i.e. dokku-18.- See Also:
-
-
Constructor Details
-
DokkuController
public DokkuController()
-
-
Method Details
-
allDokkuNames
Returns every dokku instance name in order,dokku-00throughdokku-18.- Returns:
- the dokku instance names
-
usernameFromEmail
-
usernameFor
Returns the dokku username for an email: the translated username if there is aDokkuAccountTranslationfor the email (compared in canonical form), otherwise the part of the email before the@.- Parameters:
email- the email addresstranslations- map from canonical email to dokku username- Returns:
- the dokku username
-
dokkuNameForTeam
Returns the dokku instance named by a team, if the team name has the formxxx-yyandyyis betweenLOWEST_DOKKU_NUMBERandHIGHEST_DOKKU_NUMBERinclusive.- 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
-