forked from SteamWar/SteamWar
Backend Fixes
This commit is contained in:
@@ -79,7 +79,7 @@ fun Route.configureUserPerms() {
|
||||
call.respond(RespondUserPermsPrefix(RespondPrefix(prefix.name, prefixs.colorCode, prefixs.chatPrefix), perms))
|
||||
}
|
||||
put("/prefix/{prefix}") {
|
||||
val (user, prefix) = call.receivePermission("prefix") ?: return@put
|
||||
val (user, prefix) = call.receivePermission("prefix", isPrefix = true) ?: return@put
|
||||
|
||||
user.perms().filter { it.name.startsWith("PREFIX_") }.forEach {
|
||||
UserPerm.removePerm(user, it)
|
||||
@@ -121,7 +121,8 @@ suspend fun ApplicationCall.receivePermission(fieldName: String = "perm", isPref
|
||||
|
||||
val perm = parameters[fieldName]
|
||||
val permission = UserPerm.entries.find { it.name == perm }
|
||||
if (perm == null || perm.startsWith("PREFIX_") == isPrefix || permission == null) {
|
||||
if (perm == null || perm.startsWith("PREFIX_") != isPrefix || permission == null) {
|
||||
println(perm)
|
||||
respond(HttpStatusCode.BadRequest)
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user