Blame view

src/main/java/etunicorn/LoginController.java 1.31 KB
bae3c9f4   Geoffrey PREUD'HOMME   /login pour debug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  package etunicorn;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.http.HttpStatus;
  import org.springframework.http.ResponseEntity;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.RestController;
  
  import java.util.Date;
  
  /**
   * Created by geoffrey on 04/02/17.
   */
  @RestController
  public class LoginController implements etunicorn.generated.LoginController {
      @Autowired
      private PermissionRepository permissionRepository;
  
      @Override
      public ResponseEntity<?> updateLogin(@RequestParam String login, @RequestParam String password) {
          // TODO C'est du debug !
          Role role = new Role();
          role.setNom("superman");
          for (Permission permission : permissionRepository.findAll()) {
              role.addPermission(permission);
          }
          Personne personne = new Personne();
          personne.setLogin("gbontoux");
          personne.setCarte("39cdd9ed0b191d");
          personne.setNaissance(new Date("14-Feb-1997"));
          personne.setRole(role);
          return new ResponseEntity<Object>(personne, HttpStatus.OK);
      }
  
      @Override
      public ResponseEntity<?> deleteLoginByToken(@PathVariable String token) {
          return null;
      }
  }