Skip to content

Commit 1a2b76a

Browse files
committed
Hotfix
1 parent e2b142d commit 1a2b76a

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

backend/src/main/java/com/youdemy/controller/api/CourseRestController.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ public ResponseEntity<Course> postNewCourse(@RequestBody Course newCourse, Model
8787

8888
Principal principal = request.getUserPrincipal();
8989

90-
System.out.println("Aquiiiiiiiiii: "+principal);
91-
9290
if(principal != null){
9391

9492
User author = userService.findByFirstName(principal.getName());
@@ -104,8 +102,6 @@ public ResponseEntity<Course> postNewCourse(@RequestBody Course newCourse, Model
104102

105103
courseService.save(newCourse);
106104

107-
System.out.println(newCourse.getLessons());
108-
109105
URI location = fromCurrentRequest().path("/{id}").buildAndExpand(newCourse.getId()).toUri();
110106
return ResponseEntity.created(location).body(newCourse);
111107

backend/src/main/java/com/youdemy/security/RestSecurityConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ protected void configure(HttpSecurity http) throws Exception {
5050
http.antMatcher("/api/**");
5151

5252
// URLs that need authentication to access to it
53-
http.authorizeRequests().antMatchers(HttpMethod.POST, "/api/books/**").hasRole("USER");
54-
http.authorizeRequests().antMatchers(HttpMethod.PUT, "/api/books/**").hasRole("USER");
55-
http.authorizeRequests().antMatchers(HttpMethod.DELETE, "/api/books/**").hasRole("ADMIN");
53+
http.authorizeRequests().antMatchers(HttpMethod.POST, "/api/courses/**").hasRole("USER");
54+
http.authorizeRequests().antMatchers(HttpMethod.PUT, "/api/courses/**").hasRole("USER");
55+
http.authorizeRequests().antMatchers(HttpMethod.DELETE, "/api/courses/**").hasRole("ADMIN");
5656

5757
// Other URLs can be accessed without authentication
5858
http.authorizeRequests().anyRequest().permitAll();

0 commit comments

Comments
 (0)