Skip to content

Commit

Permalink
Merge pull request #190 from prgrms-web-devcourse-final-project/refac…
Browse files Browse the repository at this point in the history
…tor/#189-role

refactor: 정지 유저 접근 권한 제한
  • Loading branch information
hgh1472 authored Dec 9, 2024
2 parents 043facc + 85303ef commit 1bf6494
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions src/main/java/postman/bottler/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
Expand Down Expand Up @@ -59,6 +60,11 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.requestMatchers("/v3/api-docs/**").permitAll()
.requestMatchers("/v3/**").permitAll()
.requestMatchers("/healthcheck").permitAll()
.requestMatchers(HttpMethod.POST,"/letters").hasAnyRole("USER", "DEVELOPER")
.requestMatchers(HttpMethod.POST, "/map/public").hasAnyRole("USER", "DEVELOPER")
.requestMatchers(HttpMethod.POST, "/map/target").hasAnyRole("USER", "DEVELOPER")
.requestMatchers(HttpMethod.POST, "/letters/replies/{letterId}").hasAnyRole("USER", "DEVELOPER")
.requestMatchers(HttpMethod.POST, "/map/reply").hasAnyRole("USER", "DEVELOPER")
.anyRequest().authenticated()
)
.sessionManagement(session -> session
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/postman/bottler/scheduler/SchedulerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ public class SchedulerConfig {
private final RecommendationScheduler recommendationScheduler;
private final UnbanScheduler unbanScheduler;

// @Scheduled(cron = "0 0 0 * * ?")
// public void unban() {
// unbanScheduler.unbanUsers(LocalDateTime.now());
// }
//
// @Scheduled(cron = "0 0 8,17,22 * * *")
// public void executeRecommendationJob() {
// recommendationScheduler.processAllUserRecommendations();
// }
//
// @Scheduled(cron = "0 0 9,18,23 * * ?")
// public void recommendKeywordLetter() {
// recommendationScheduler.updateAllRecommendations();
// }
@Scheduled(cron = "0 0 0 * * ?")
public void unban() {
unbanScheduler.unbanUsers(LocalDateTime.now());
}

@Scheduled(cron = "0 0 23,11,17 * * *")
public void executeRecommendationJob() {
recommendationScheduler.processAllUserRecommendations();
}

@Scheduled(cron = "0 0 0,12,18 * * ?")
public void recommendKeywordLetter() {
recommendationScheduler.updateAllRecommendations();
}
}

0 comments on commit 1bf6494

Please sign in to comment.