Skip to content

Commit

Permalink
refactor: (#271) detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
softpeanut committed Feb 26, 2023
1 parent dbfdace commit 3680850
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,22 @@ class SecurityConfiguration(
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
http
.authorizeRequests()

// healthcheck
.antMatchers(HttpMethod.GET, "/").permitAll()

// /auth
.antMatchers(HttpMethod.GET, "/auth/account-id").permitAll()
.antMatchers(HttpMethod.GET, "/auth/email").permitAll()
.antMatchers(HttpMethod.GET, "/auth/code").permitAll()
.antMatchers(HttpMethod.POST, "/auth/code").permitAll()
.antMatchers(HttpMethod.POST, "/auth/tokens").permitAll()
.antMatchers(HttpMethod.PUT, "/auth/reissue").permitAll()

// /users
.antMatchers(HttpMethod.GET, "/users/password").hasAnyAuthority(STUDENT.name, MANAGER.name)
.antMatchers(HttpMethod.PATCH, "/users/password").hasAnyAuthority(STUDENT.name, MANAGER.name)

// /students
.antMatchers(HttpMethod.GET, "/students/email/duplication").permitAll()
.antMatchers(HttpMethod.GET, "/students/account-id/duplication").permitAll()
Expand All @@ -62,25 +66,30 @@ class SecurityConfiguration(
.antMatchers(HttpMethod.GET, "/managers/profile").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.PATCH, "managers/password/initialization").permitAll()
.antMatchers(HttpMethod.DELETE, "/managers/students/{student-id}").hasAuthority(MANAGER.name)

// /schools
.antMatchers(HttpMethod.GET, "/schools").permitAll()
.antMatchers(HttpMethod.GET, "/schools/question/{school-id}").permitAll()
.antMatchers(HttpMethod.GET, "/schools/answer/{school-id}").permitAll()
.antMatchers(HttpMethod.GET, "/schools/code").permitAll()
.antMatchers(HttpMethod.PATCH, "/schools/question").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.PATCH, "/schools/code").hasAuthority(MANAGER.name)

// /notices
.antMatchers(HttpMethod.GET, "/notices/status").hasAuthority(STUDENT.name)
.antMatchers(HttpMethod.GET, "/notices").hasAnyAuthority(STUDENT.name, MANAGER.name)
.antMatchers(HttpMethod.GET, "/notices/{notice-id}").hasAnyAuthority(STUDENT.name, MANAGER.name)
.antMatchers(HttpMethod.POST, "/notices").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.PATCH, "/notices/{notice-id}").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.DELETE, "/notices/{notice-id}").hasAuthority(MANAGER.name)

// /files
.antMatchers(HttpMethod.POST, "/files").permitAll()
.antMatchers(HttpMethod.POST, "/files/verified-student").permitAll()

// /meals
.antMatchers(HttpMethod.GET, "/meals/{date}").hasAuthority(STUDENT.name)

// /points
.antMatchers(HttpMethod.GET, "/points").hasAuthority(STUDENT.name)
.antMatchers(HttpMethod.POST, "/points/options").hasAuthority(MANAGER.name)
Expand All @@ -92,11 +101,13 @@ class SecurityConfiguration(
.antMatchers(HttpMethod.PUT, "/points/history/{point-history-id}").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.GET, "/points/options").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.PATCH, "/points/options/{point-option-id}").hasAuthority(MANAGER.name)

// /templates
.antMatchers(HttpMethod.GET, "/templates").permitAll()
.antMatchers(HttpMethod.POST, "/templates").permitAll()
.antMatchers(HttpMethod.PATCH, "/templates").permitAll()
.antMatchers(HttpMethod.DELETE, "/templates").permitAll()

// /study-rooms
.antMatchers(HttpMethod.GET, "/study-rooms/available-time").hasAnyAuthority(STUDENT.name, MANAGER.name)
.antMatchers(HttpMethod.PUT, "/study-rooms/available-time").hasAuthority(MANAGER.name)
Expand All @@ -113,6 +124,7 @@ class SecurityConfiguration(
.antMatchers(HttpMethod.GET, "/study-rooms/list/managers").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.DELETE, "/study-rooms/types/{type-id}").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.GET, "/study-rooms/my").hasAuthority(STUDENT.name)

// /remains
.antMatchers(HttpMethod.PUT, "/remains/{remain-option-id}").hasAuthority(STUDENT.name)
.antMatchers(HttpMethod.POST, "/remains/options").hasAuthority(MANAGER.name)
Expand All @@ -123,6 +135,7 @@ class SecurityConfiguration(
.antMatchers(HttpMethod.DELETE, "/remains/options/{remain-option-id}").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.PUT, "/remains/available-time").hasAuthority(MANAGER.name)
.antMatchers(HttpMethod.GET, "/remains/status/file").hasAuthority(MANAGER.name)

.anyRequest().denyAll()

http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class RemainStatusPersistenceAdapter(
}
}


override fun deleteRemainStatusByRemainOptionId(remainOptionId: UUID) {
remainStatusRepository.deleteByRemainOptionId(remainOptionId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ class UserPersistenceAdapter(
userRepository.findByAccountId(accountId)
)
}

0 comments on commit 3680850

Please sign in to comment.