| 1 | package edu.ucsb.cs156.dining.controllers; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.dining.models.CurrentUser; | |
| 4 | ||
| 5 | import io.swagger.v3.oas.annotations.Operation; | |
| 6 | import io.swagger.v3.oas.annotations.tags.Tag; | |
| 7 | ||
| 8 | import org.springframework.security.access.prepost.PreAuthorize; | |
| 9 | import org.springframework.web.bind.annotation.GetMapping; | |
| 10 | import org.springframework.web.bind.annotation.PostMapping; | |
| 11 | import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | import org.springframework.web.bind.annotation.RequestParam; | |
| 13 | import org.springframework.web.bind.annotation.RestController; | |
| 14 | ||
| 15 | ||
| 16 | /** | |
| 17 |  * This is a REST controller for getting information about the current user. | |
| 18 |  */ | |
| 19 | ||
| 20 | @Tag(name="Current User Information") | |
| 21 | @RequestMapping("/api/currentUser") | |
| 22 | @RestController | |
| 23 | public class UserInfoController extends ApiController { | |
| 24 |   | |
| 25 |   /** | |
| 26 |    * This method returns the current user. | |
| 27 |    * @return the current user | |
| 28 |    */ | |
| 29 | ||
| 30 |   @Operation(summary= "Get information about current user") | |
| 31 |   @PreAuthorize("hasRole('ROLE_USER')") | |
| 32 |   @GetMapping("") | |
| 33 |   public CurrentUser getCurrentUser() { | |
| 34 | 
1
1. getCurrentUser : replaced return value with null for edu/ucsb/cs156/dining/controllers/UserInfoController::getCurrentUser → KILLED | 
    return super.getCurrentUser(); | 
| 35 |   } | |
| 36 | } | |
Mutations | ||
| 34 | 
 
 1.1  |