Skip to content

Commit

Permalink
chore: rm debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiinaKin committed Sep 14, 2024
1 parent 9944085 commit 06caef9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 37 deletions.
2 changes: 2 additions & 0 deletions app/src/main/kotlin/io/sakurasou/controller/AuthController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import io.ktor.server.response.*
import io.ktor.server.routing.*
import io.sakurasou.controller.request.UserInsertRequest
import io.sakurasou.controller.request.UserLoginRequest
import io.sakurasou.extension.success
import io.sakurasou.service.auth.AuthService
import io.sakurasou.service.user.UserService

Expand Down Expand Up @@ -50,6 +51,7 @@ private fun Route.signup(authController: AuthController) {
}) {
val userInsertRequest = call.receive<UserInsertRequest>()
authController.handleSignup(userInsertRequest)
call.success()
}
}

Expand Down
42 changes: 8 additions & 34 deletions app/src/main/kotlin/io/sakurasou/extension/RouteExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import io.sakurasou.config.InstanceCenter
import io.sakurasou.controller.request.PageRequest
import io.sakurasou.controller.vo.CommonResponse
import io.sakurasou.exception.ServiceThrowable
import io.sakurasou.exception.SiteNotInitializationException
import io.sakurasou.exception.UnauthorizedAccessException
import io.sakurasou.exception.WrongParameterException
import org.jetbrains.exposed.sql.exposedLogger

/**
* @author Shiina Kin
Expand Down Expand Up @@ -78,10 +76,7 @@ fun Route.post(
body: PipelineInterceptor<Unit, ApplicationCall>
): Route {
intercept(ApplicationCallPipeline.Call) {
if (lackPermission(call.attributes, permission)) {
throw UnauthorizedAccessException()
}
exposedLogger.debug("====== access permission check ======")
if (lackPermission(call.attributes, permission)) throw UnauthorizedAccessException()
}
return documentation(builder) { post(body) }
}
Expand All @@ -98,10 +93,7 @@ fun Route.delete(
body: PipelineInterceptor<Unit, ApplicationCall>
): Route {
intercept(ApplicationCallPipeline.Call) {
if (lackPermission(call.attributes, permission)) {
throw UnauthorizedAccessException()
}
exposedLogger.debug("====== access permission check ======")
if (lackPermission(call.attributes, permission)) throw UnauthorizedAccessException()
}
return documentation(builder) { delete(body) }
}
Expand All @@ -118,10 +110,7 @@ fun Route.patch(
body: PipelineInterceptor<Unit, ApplicationCall>
): Route {
intercept(ApplicationCallPipeline.Call) {
if (lackPermission(call.attributes, permission)) {
throw UnauthorizedAccessException()
}
exposedLogger.debug("====== access permission check ======")
if (lackPermission(call.attributes, permission)) throw UnauthorizedAccessException()
}
return documentation(builder) { patch(body) }
}
Expand All @@ -138,10 +127,7 @@ fun Route.get(
body: PipelineInterceptor<Unit, ApplicationCall>
): Route {
intercept(ApplicationCallPipeline.Call) {
if (lackPermission(call.attributes, permission)) {
throw UnauthorizedAccessException()
}
exposedLogger.debug("====== access permission check ======")
if (lackPermission(call.attributes, permission)) throw UnauthorizedAccessException()
}
return documentation(builder) { get(body) }
}
Expand All @@ -159,10 +145,7 @@ fun Route.post(
body: PipelineInterceptor<Unit, ApplicationCall>
): Route {
intercept(ApplicationCallPipeline.Call) {
if (lackPermission(call.attributes, permission)) {
throw UnauthorizedAccessException()
}
exposedLogger.debug("====== access permission check ======")
if (lackPermission(call.attributes, permission)) throw UnauthorizedAccessException()
}
return documentation(builder) { post(path, body) }
}
Expand All @@ -180,10 +163,7 @@ fun Route.delete(
body: PipelineInterceptor<Unit, ApplicationCall>
): Route {
intercept(ApplicationCallPipeline.Call) {
if (lackPermission(call.attributes, permission)) {
throw UnauthorizedAccessException()
}
exposedLogger.debug("====== access permission check ======")
if (lackPermission(call.attributes, permission)) throw UnauthorizedAccessException()
}
return documentation(builder) { delete(path, body) }
}
Expand All @@ -201,10 +181,7 @@ fun Route.patch(
body: PipelineInterceptor<Unit, ApplicationCall>
): Route {
intercept(ApplicationCallPipeline.Call) {
if (lackPermission(call.attributes, permission)) {
throw UnauthorizedAccessException()
}
exposedLogger.debug("====== access permission check ======")
if (lackPermission(call.attributes, permission)) throw UnauthorizedAccessException()
}
return documentation(builder) { patch(path, body) }
}
Expand All @@ -222,10 +199,7 @@ fun Route.get(
body: PipelineInterceptor<Unit, ApplicationCall>
): Route {
intercept(ApplicationCallPipeline.Call) {
if (lackPermission(call.attributes, permission)) {
throw UnauthorizedAccessException()
}
exposedLogger.debug("====== access permission check ======")
if (lackPermission(call.attributes, permission)) throw UnauthorizedAccessException()
}
return documentation(builder) { get(path, body) }
}
4 changes: 1 addition & 3 deletions app/src/main/kotlin/io/sakurasou/plugins/Routing.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.sakurasou.plugins

import io.github.smiley4.ktorswaggerui.dsl.routing.get
import io.github.smiley4.ktorswaggerui.dsl.routing.route
import io.ktor.http.*
import io.ktor.server.application.*
Expand Down Expand Up @@ -58,9 +59,6 @@ fun Application.configureRouting() {
call.attributes.put(AttributeKey("username"), username)
call.attributes.put(AttributeKey("roles"), roles)
}
get("helloworld") {
call.respond(call.attributes.getPrincipal())
}
imageRoute()
albumRoute()
strategyRoute()
Expand Down

0 comments on commit 06caef9

Please sign in to comment.