Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
meltapplee committed Apr 10, 2024
2 parents 9b30184 + a51e3b8 commit f393ff5
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package dsm.pick2024.domain.admin.service

import dsm.pick2024.domain.admin.port.`in`.QueryAdminAllUseCase
import dsm.pick2024.domain.admin.port.out.FindAllPort
import dsm.pick2024.domain.user.entity.enums.Role
import org.springframework.stereotype.Service

@Service
class QueryAdminAllService(
private val findAllPort: FindAllPort
) : QueryAdminAllUseCase {
override fun queryAdminAll(): List<String> = findAllPort.findAll().map { it.name }
override fun queryAdminAll(): List<String> = findAllPort.findAll().filter { it.role == Role.SCH }.map { it.name }
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package dsm.pick2024.domain.user.entity.enums

enum class Role {
STU, SCH
STU,
SCH,
COOK,
SEC
}
182 changes: 95 additions & 87 deletions src/main/kotlin/dsm/pick2024/global/config/security/SecurityConfig.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package dsm.pick2024.global.config.security

import com.fasterxml.jackson.databind.ObjectMapper
import dsm.pick2024.domain.user.entity.enums.Role
import dsm.pick2024.global.config.filter.FilterConfig
import dsm.pick2024.global.security.jwt.JwtTokenProvider
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.http.SessionCreationPolicy
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
Expand All @@ -30,93 +32,99 @@ class SecurityConfig(
http.authorizeRequests()
.requestMatchers(CorsUtils::isCorsRequest)
.permitAll()
// .antMatchers(
// HttpMethod.POST,
// "/dsm-pick/after/**",
// "/dsm-pick/meal",
// "/dsm-pick/notice",
// "/dsm-pick/schedule/create",
// "/dsm-pick/self-study/register",
// "/dsm-pick/timetable",
// "/dsm-pick/weekend-meal/saveAll",
// "dsm-pick/status/saveAll",
// "dsm-pick/schedule/**"
// ).hasRole(Role.SCH.toString())
// .antMatchers(
// HttpMethod.GET,
// "/dsm-pick/admin/**",
// "/dsm-pick/after/**",
// "/dsm-pick/application/reason/all",
// "/dsm-pick/application/non-return",
// "/dsm-pick/application/status",
// "/dsm-pick/application/floor",
// "/dsm-pick/application/grade",
// "/dsm-pick/application/all",
// "/dsm-pick/story/**",
// "/dsm-pick/class-room/floor",
// "/dsm-pick/class-room/grade",
// "/dsm-pick/early-return/grade",
// "/dsm-pick/early-return/floor",
// "/dsm-pick/early-return/reason/ok-all",
// "/dsm-pick/early-return/ok",
// "/dsm-pick/early-return/all",
// "/dsm-pick/self-study/month",
// "/dsm-pick/self-study/date",
// "/dsm-pick/self-study/admin",
// "/dsm-pick/weekend-meal/all",
// "/dsm-pick/weekend-meal/quit",
// "/dsm-pick/weekend-meal/excel",
// "/dsm-pick/weekend-meal/hey",
// "/dsm-pick/status/**",
// "/dsm-pick/user/all"
// ).hasRole(Role.SCH.toString())
// .antMatchers(
// HttpMethod.PATCH,
// "/dsm-pick/application/**",
// "/dsm-pick/early-return/**",
// "/dsm-pick/notice/modify",
// "/dsm-pick/status/change",
// "/dsm-pick/weekend-meal/status",
// "dsm-pick/schedule/modify",
// "dsm-pick/after/change",
// "/dsm-pick/class-room/status"
// ).hasRole(Role.SCH.toString())
// .antMatchers(
// HttpMethod.DELETE,
// "/dsm-pick/after/**",
// "/dsm-pick/notice/delete/",
// "/dsm-pick/schedule/delete/",
// "/dsm-pick/after/delete"
// )
// .hasRole(Role.SCH.toString())
// .antMatchers(
// HttpMethod.POST,
// "/dsm-pick/application",
// "/dsm-pick/class-room/move",
// "/dsm-pick/early-return/create"
// ).hasRole(Role.STU.toString())
// .antMatchers(
// HttpMethod.PATCH,
// "/dsm-pick/application/status",
// "/dsm-pick/weekend-meal/my-status"
// ).hasRole(Role.STU.toString())
// .antMatchers(
// HttpMethod.GET,
// "dsm-pick/user/simple",
// "dsm-pick/user/details",
// "/dsm-pick/application/my",
// "/dsm-pick/application/simple",
// "/dsm-pick/class-room/move",
// "/dsm-pick/early-return/my",
// "/dsm-pick/meal/date",
// "/dsm-pick/timetable/**",
// "/dsm-pick/weekend-meal/my",
// "/dsm-pick/main"
// ).hasRole(Role.STU.toString())
// .antMatchers(
// HttpMethod.DELETE,
// "/dsm-pick/class-room/return"
// ).hasRole(Role.STU.toString())
.antMatchers(
HttpMethod.POST,
"/dsm-pick/after/**",
"/dsm-pick/meal",
"/dsm-pick/notice",
"/dsm-pick/schedule/create",
"/dsm-pick/self-study/register",
"/dsm-pick/timetable",
"/dsm-pick/weekend-meal/saveAll",
"dsm-pick/status/saveAll",
"dsm-pick/schedule/**"
).hasRole(Role.SCH.toString())
.antMatchers(
HttpMethod.GET,
"/dsm-pick/admin/**",
"/dsm-pick/after/**",
"/dsm-pick/application/reason/all",
"/dsm-pick/application/status",
"/dsm-pick/application/floor",
"/dsm-pick/application/grade",
"/dsm-pick/application/all",
"/dsm-pick/story/**",
"/dsm-pick/class-room/floor",
"/dsm-pick/class-room/grade",
"/dsm-pick/early-return/grade",
"/dsm-pick/early-return/floor",
"/dsm-pick/early-return/reason/ok-all",
"/dsm-pick/early-return/ok",
"/dsm-pick/early-return/all",
"/dsm-pick/self-study/month",
"/dsm-pick/self-study/date",
"/dsm-pick/self-study/admin",
"/dsm-pick/weekend-meal/all",
"/dsm-pick/weekend-meal/quit",
"/dsm-pick/weekend-meal/hey",
"/dsm-pick/status/**",
"/dsm-pick/user/all"
).hasRole(Role.SCH.toString())
.antMatchers(
HttpMethod.PATCH,
"/dsm-pick/application/**",
"/dsm-pick/early-return/**",
"/dsm-pick/notice/modify",
"/dsm-pick/status/change",
"/dsm-pick/weekend-meal/status",
"dsm-pick/schedule/modify",
"dsm-pick/after/change",
"/dsm-pick/class-room/status"
).hasRole(Role.SCH.toString())
.antMatchers(
HttpMethod.DELETE,
"/dsm-pick/after/**",
"/dsm-pick/notice/delete/",
"/dsm-pick/schedule/delete/",
"/dsm-pick/after/delete"
)
.hasRole(Role.SCH.toString())
.antMatchers(
HttpMethod.POST,
"/dsm-pick/application",
"/dsm-pick/class-room/move",
"/dsm-pick/early-return/create"
).hasRole(Role.STU.toString())
.antMatchers(
HttpMethod.PATCH,
"/dsm-pick/application/status",
"/dsm-pick/weekend-meal/my-status"
).hasRole(Role.STU.toString())
.antMatchers(
HttpMethod.GET,
"dsm-pick/user/simple",
"dsm-pick/user/details",
"/dsm-pick/application/my",
"/dsm-pick/application/simple",
"/dsm-pick/class-room/move",
"/dsm-pick/early-return/my",
"/dsm-pick/meal/date",
"/dsm-pick/timetable/**",
"/dsm-pick/weekend-meal/my",
"/dsm-pick/main"
).hasRole(Role.STU.toString())
.antMatchers(
HttpMethod.DELETE,
"/dsm-pick/class-room/return"
).hasRole(Role.STU.toString())
.antMatchers(
HttpMethod.GET,
"/dsm-pick/application/non-return"
).hasAnyRole(Role.SCH.toString(), Role.SEC.toString())
.antMatchers(
HttpMethod.GET,
"/dsm-pick/weekend-meal/excel"
).hasAnyRole(Role.SCH.toString(), Role.COOK.toString())

http
.apply(FilterConfig(objectMapper, jwtTokenProvider))
Expand Down

0 comments on commit f393ff5

Please sign in to comment.