Commit a0940d93449dadfd9ca399693a517a922acf2662
1 parent
474776a8
Can Login
Showing
6 changed files
with
45 additions
and
37 deletions
Show diff stats
.idea/dataSources.local.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <project version="4"> |
3 | 3 | <component name="dataSourceStorageLocal"> |
4 | - <data-source name="etunicorn.db" uuid="ebfeef5a-f196-4340-9424-14e4e8aaadbb"> | |
4 | + <data-source name="etunicorn.db" uuid="7ff25d0f-17b0-48bb-a8e6-be9293e5e8dc"> | |
5 | 5 | <database-info product="SQLite" version="3.8.11" jdbc-version="2.1" driver-name="SQLiteJDBC" driver-version="native" /> |
6 | 6 | <case-sensitivity plain-identifiers="mixed" quoted-identifiers="mixed" /> |
7 | 7 | <secret-storage>master_key</secret-storage> | ... | ... |
.idea/dataSources.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <project version="4"> |
3 | 3 | <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> |
4 | - <data-source source="LOCAL" name="etunicorn.db" uuid="ebfeef5a-f196-4340-9424-14e4e8aaadbb"> | |
4 | + <data-source source="LOCAL" name="etunicorn.db" uuid="7ff25d0f-17b0-48bb-a8e6-be9293e5e8dc"> | |
5 | 5 | <driver-ref>sqlite.xerial</driver-ref> |
6 | 6 | <synchronize>true</synchronize> |
7 | 7 | <jdbc-driver>org.sqlite.JDBC</jdbc-driver> |
8 | 8 | <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/etunicorn.db</jdbc-url> |
9 | + <driver-properties> | |
10 | + <property name="enable_load_extension" value="true" /> | |
11 | + </driver-properties> | |
9 | 12 | </data-source> |
10 | 13 | </component> |
11 | 14 | </project> |
12 | 15 | \ No newline at end of file | ... | ... |
src/main/java/etunicorn/SecurityInterceptor.java
... | ... | @@ -53,12 +53,14 @@ public class SecurityInterceptor extends HandlerInterceptorAdapter { |
53 | 53 | |
54 | 54 | if (annotation != null) { |
55 | 55 | Permission requiredPermission = permissionRepository.findByNom(annotation.value()); |
56 | - if (requiredPermission == null) { | |
57 | - response.setStatus(HttpStatus.NOT_IMPLEMENTED.value()); | |
58 | - return false; | |
59 | - } | |
60 | 56 | |
61 | 57 | if (annotation.authentifie()) { |
58 | + if (requiredPermission == null) { | |
59 | + response.setStatus(HttpStatus.NOT_IMPLEMENTED.value()); | |
60 | + // TODO utiliser base controller | |
61 | + return false; | |
62 | + } | |
63 | + | |
62 | 64 | BaseController baseController = new BaseController(); |
63 | 65 | baseController.setRequest(request); |
64 | 66 | if (session == null) { | ... | ... |
src/main/java/etunicorn/generated/LoginController.java
1 | 1 | |
2 | 2 | package etunicorn.generated; |
3 | 3 | |
4 | +import javax.validation.Valid; | |
4 | 5 | import etunicorn.generated.model.UpdateLoginRequest; |
5 | 6 | import org.springframework.http.ResponseEntity; |
6 | 7 | import org.springframework.web.bind.annotation.RequestBody; |
... | ... | @@ -8,8 +9,6 @@ import org.springframework.web.bind.annotation.RequestMapping; |
8 | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
9 | 10 | import org.springframework.web.bind.annotation.RestController; |
10 | 11 | |
11 | -import javax.validation.Valid; | |
12 | - | |
13 | 12 | |
14 | 13 | /** |
15 | 14 | * No description |
... | ... | @@ -26,16 +25,16 @@ public interface LoginController { |
26 | 25 | * |
27 | 26 | */ |
28 | 27 | @RequestMapping(value = "", method = RequestMethod.POST) |
29 | - ResponseEntity<?> updateLogin( | |
30 | - @Valid | |
31 | - @RequestBody | |
32 | - UpdateLoginRequest updateLoginRequest); | |
28 | + public ResponseEntity<?> updateLogin( | |
29 | + @Valid | |
30 | + @RequestBody | |
31 | + UpdateLoginRequest updateLoginRequest); | |
33 | 32 | |
34 | 33 | /** |
35 | 34 | * Se déconnecter |
36 | 35 | * |
37 | 36 | */ |
38 | 37 | @RequestMapping(value = "", method = RequestMethod.DELETE) |
39 | - ResponseEntity<?> deleteLogin(); | |
38 | + public ResponseEntity<?> deleteLogin(); | |
40 | 39 | |
41 | 40 | } | ... | ... |
src/main/java/etunicorn/generated/RoleController.java
... | ... | @@ -25,55 +25,55 @@ public interface RoleController { |
25 | 25 | * |
26 | 26 | */ |
27 | 27 | @RequestMapping(value = "", method = RequestMethod.GET) |
28 | - ResponseEntity<?> getRole(); | |
28 | + public ResponseEntity<?> getRole(); | |
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Ajoute un nouveau rôle. Nécessite ROLE_ADMIN |
32 | 32 | * |
33 | 33 | */ |
34 | 34 | @RequestMapping(value = "", method = RequestMethod.POST) |
35 | - ResponseEntity<?> updateRole( | |
36 | - @javax.validation.Valid | |
37 | - @org.springframework.web.bind.annotation.RequestBody | |
38 | - UpdateRoleRequest updateRoleRequest); | |
35 | + public ResponseEntity<?> updateRole( | |
36 | + @javax.validation.Valid | |
37 | + @org.springframework.web.bind.annotation.RequestBody | |
38 | + UpdateRoleRequest updateRoleRequest); | |
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Supprime un rôle. Nécessite ROLE_ADMIN |
42 | 42 | * |
43 | 43 | */ |
44 | 44 | @RequestMapping(value = "/{nomRole}", method = RequestMethod.DELETE) |
45 | - ResponseEntity<?> deleteRoleById( | |
46 | - @PathVariable | |
47 | - String nomRole); | |
45 | + public ResponseEntity<?> deleteRoleById( | |
46 | + @PathVariable | |
47 | + String nomRole); | |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Ajoute une permission à un rôle. Nécessite ROLE_ADMIN |
51 | 51 | * |
52 | 52 | */ |
53 | 53 | @RequestMapping(value = "/{nomRole}", method = RequestMethod.POST) |
54 | - ResponseEntity<?> updateRoleById( | |
55 | - @PathVariable | |
56 | - String nomRole, | |
57 | - @javax.validation.Valid | |
58 | - @org.springframework.web.bind.annotation.RequestBody | |
59 | - UpdateRoleByIdRequest updateRoleByIdRequest); | |
54 | + public ResponseEntity<?> updateRoleById( | |
55 | + @PathVariable | |
56 | + String nomRole, | |
57 | + @javax.validation.Valid | |
58 | + @org.springframework.web.bind.annotation.RequestBody | |
59 | + UpdateRoleByIdRequest updateRoleByIdRequest); | |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Enlève la permission du rôle. Nécessite ROLE_ADMIN |
63 | 63 | * |
64 | 64 | */ |
65 | 65 | @RequestMapping(value = "/{nomRole}/{nomPermission}", method = RequestMethod.DELETE) |
66 | - ResponseEntity<?> deleteRoleByNomPermission( | |
67 | - @PathVariable | |
68 | - String nomPermission, | |
69 | - @PathVariable | |
70 | - String nomRole); | |
66 | + public ResponseEntity<?> deleteRoleByNomPermission( | |
67 | + @PathVariable | |
68 | + String nomPermission, | |
69 | + @PathVariable | |
70 | + String nomRole); | |
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Liste les permissions. Nécessite ROLE_ADMIN |
74 | 74 | * |
75 | 75 | */ |
76 | 76 | @RequestMapping(value = "/permission", method = RequestMethod.GET) |
77 | - ResponseEntity<?> getPermission(); | |
77 | + public ResponseEntity<?> getPermission(); | |
78 | 78 | |
79 | 79 | } | ... | ... |
src/main/java/etunicorn/generated/model/UpdatePersonneRequest.java
1 | 1 | |
2 | 2 | package etunicorn.generated.model; |
3 | 3 | |
4 | -import com.fasterxml.jackson.annotation.*; | |
4 | +import java.util.HashMap; | |
5 | +import java.util.Map; | |
6 | +import com.fasterxml.jackson.annotation.JsonAnyGetter; | |
7 | +import com.fasterxml.jackson.annotation.JsonAnySetter; | |
8 | +import com.fasterxml.jackson.annotation.JsonIgnore; | |
9 | +import com.fasterxml.jackson.annotation.JsonInclude; | |
10 | +import com.fasterxml.jackson.annotation.JsonProperty; | |
11 | +import com.fasterxml.jackson.annotation.JsonPropertyOrder; | |
5 | 12 | import org.apache.commons.lang.builder.EqualsBuilder; |
6 | 13 | import org.apache.commons.lang.builder.HashCodeBuilder; |
7 | 14 | import org.apache.commons.lang.builder.ToStringBuilder; |
8 | 15 | |
9 | -import java.util.HashMap; | |
10 | -import java.util.Map; | |
11 | - | |
12 | 16 | @JsonInclude(JsonInclude.Include.NON_NULL) |
13 | 17 | @JsonPropertyOrder({ |
14 | 18 | "carte", | ... | ... |