Package com.plannaplan.controllers
Class UsersController
java.lang.Object
com.plannaplan.controllers.UsersController
@RestController
@CrossOrigin
@RequestMapping("/api/v1/users")
@EnableGlobalMethodSecurity(prePostEnabled=true)
public class UsersController
extends java.lang.Object
Rest controller to assignments related endpoints. More detailed api docs is
available via swagger
-
Constructor Summary
Constructors Constructor Description UsersController()
-
Method Summary
Modifier and Type Method Description org.springframework.http.ResponseEntity<java.lang.String>
addAdmin(java.lang.String authority)
org.springframework.http.ResponseEntity<java.lang.String>
addDeanery(java.lang.String authority)
org.springframework.http.ResponseEntity<java.util.List<UserResponse>>
getAllStudents()
org.springframework.http.ResponseEntity<java.util.List<UserResponse>>
searchForStudent(java.lang.String query)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
UsersController
public UsersController()
-
-
Method Details
-
searchForStudent
@GetMapping("/student/search") @PreAuthorize("hasRole(\'ROLE_DEANERY\')") public org.springframework.http.ResponseEntity<java.util.List<UserResponse>> searchForStudent(@RequestParam("query") java.lang.String query)- Parameters:
query
- to filrer userst with STUDENT role- Returns:
- list found
-
getAllStudents
@GetMapping("/students") @PreAuthorize("hasRole(\'ROLE_DEANERY\')") public org.springframework.http.ResponseEntity<java.util.List<UserResponse>> getAllStudents()- Returns:
- list of all studnents
-
addAdmin
@PostMapping(path="/admin") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<java.lang.String> addAdmin(@RequestParam("authority") java.lang.String authority)- Parameters:
authority
- USOS ID or E-mail. If user does not exist it should be USOS ID- Returns:
- response entity was operation with succcesss
-
addDeanery
@PostMapping(path="/deanery") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<java.lang.String> addDeanery(@RequestParam("authority") java.lang.String authority)- Parameters:
authority
- USOS ID or E-mail. If user does not exist it should be USOS ID- Returns:
- response entity was operation with succcesss
-