forked from SteamWar/SteamWar
Fixes...
This commit is contained in:
@@ -59,28 +59,17 @@ fun Route.configureStats() {
|
||||
|
||||
call.respond(list.map { Fight(it.first, it.second, it.third) })
|
||||
}
|
||||
route("/user/{id}") {
|
||||
install(SWPermissionCheck) {
|
||||
userCheck {
|
||||
val user = it.call.request.getUser()
|
||||
val auth = it.call.principal<SWAuthPrincipal>()
|
||||
|
||||
if (user == null || auth == null) {
|
||||
return@userCheck false
|
||||
}
|
||||
|
||||
return@userCheck user.id == auth.user.id || auth.user.hasPerm(UserPerm.MODERATION)
|
||||
}
|
||||
}
|
||||
route("/user") {
|
||||
install(SWPermissionCheck)
|
||||
get {
|
||||
val user = call.request.getUser()
|
||||
val user = call.authentication.principal<SWAuthPrincipal>()
|
||||
|
||||
if (user == null) {
|
||||
call.respond(HttpStatusCode.NotFound, "User not found")
|
||||
return@get
|
||||
}
|
||||
|
||||
call.respond(UserStats(user))
|
||||
call.respond(UserStats(user.user))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user