From b8ddc04b6191b5e13ff53d55e3f809db2aec14f4 Mon Sep 17 00:00:00 2001 From: whitemark Date: Mon, 8 Jan 2024 00:37:39 +0900 Subject: [PATCH] =?UTF-8?q?[feature/#209]=20policy=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EB=B3=B4=EC=95=88=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/inhabas/api/config/WebSecurityConfig.java | 5 +++++ .../src/main/java/com/inhabas/api/domain/BaseEntity.java | 1 + .../com/inhabas/api/domain/policy/domain/PolicyTerm.java | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/resource-server/src/main/java/com/inhabas/api/config/WebSecurityConfig.java b/resource-server/src/main/java/com/inhabas/api/config/WebSecurityConfig.java index dbaee3f6..7d383cda 100644 --- a/resource-server/src/main/java/com/inhabas/api/config/WebSecurityConfig.java +++ b/resource-server/src/main/java/com/inhabas/api/config/WebSecurityConfig.java @@ -46,6 +46,7 @@ public class WebSecurityConfig { private static final String[] AUTH_WHITELIST_SIGNUP = {"/signUp/schedule", "/signUp/questionnaires", "/signUp/majorInfo"}; private static final String[] AUTH_WHITELIST_CLUB = {"/club/histories", "/club/history/**"}; + private static final String[] AUTH_WHITELIST_POLICY = {"/policy/**"}; @Order(1) @EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true) @@ -70,6 +71,7 @@ public void configure(AuthenticationManagerBuilder auth) throws Exception { @Override public void configure(WebSecurity web) throws Exception { web.ignoring() + .antMatchers(HttpMethod.GET, AUTH_WHITELIST_POLICY) .antMatchers(HttpMethod.GET, AUTH_WHITELIST_SIGNUP) .antMatchers(HttpMethod.GET, AUTH_WHITELIST_CLUB) .antMatchers(AUTH_WHITELIST_SWAGGER) @@ -126,6 +128,9 @@ protected void configure(HttpSecurity http) throws Exception { // 동아리 연혁 수정 .antMatchers("/club/history/**").hasRole(EXECUTIVES.toString()) + // 정책 수정 + .antMatchers(HttpMethod.PUT, "/policy/**").hasAnyRole(CHIEF.toString(), VICE_CHIEF.toString()) + // 그 외 .anyRequest().hasRole(ANONYMOUS.toString()); diff --git a/resource-server/src/main/java/com/inhabas/api/domain/BaseEntity.java b/resource-server/src/main/java/com/inhabas/api/domain/BaseEntity.java index 9d655b92..a6ec71ed 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/BaseEntity.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/BaseEntity.java @@ -19,6 +19,7 @@ public abstract class BaseEntity { @Column(nullable = false, updatable = false, insertable = false, columnDefinition = "DATETIME(0) DEFAULT CURRENT_TIMESTAMP") private LocalDateTime dateCreated; + @CreatedDate @LastModifiedDate @Column(columnDefinition = "DATETIME(0)") private LocalDateTime dateUpdated; diff --git a/resource-server/src/main/java/com/inhabas/api/domain/policy/domain/PolicyTerm.java b/resource-server/src/main/java/com/inhabas/api/domain/policy/domain/PolicyTerm.java index 06a701bd..6bb3e2fa 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/policy/domain/PolicyTerm.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/policy/domain/PolicyTerm.java @@ -28,9 +28,9 @@ public class PolicyTerm extends BaseEntity { private Content content; @Builder - public PolicyTerm(PolicyType policyType, Content content) { + public PolicyTerm(PolicyType policyType, String content) { this.policyType = policyType; - this.content = content; + this.content = new Content(content); } public void updatePolicyTerm(SavePolicyTernDto savePolicyTernDto) {