From 879cd402adcee90f8ef719ad35ffae95e3f52e94 Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Mon, 18 Aug 2025 11:38:41 +0200 Subject: [PATCH] update create and edit account role mapping --- src/main/kotlin/ltd/hlaeja/util/Mapping.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/ltd/hlaeja/util/Mapping.kt b/src/main/kotlin/ltd/hlaeja/util/Mapping.kt index 024045b..df41490 100644 --- a/src/main/kotlin/ltd/hlaeja/util/Mapping.kt +++ b/src/main/kotlin/ltd/hlaeja/util/Mapping.kt @@ -16,17 +16,13 @@ fun AccountForm.toAccountRequest(): Account.Request = Account.Request( username = username, password = if (password.isNullOrEmpty()) null else password, enabled = enabled, - roles = roles.map { "ROLE_${it.uppercase()}" }, + roles = roles.map { it.uppercase() }, ) fun Account.Response.toAccountForm(): AccountForm = AccountForm( username = username, enabled = enabled, - roles = roles.map { - it.removePrefix("ROLE_") - .lowercase() - .replaceFirstChar { char -> char.uppercase() } - }, + roles = roles.map { it.lowercase().replaceFirstChar { char -> char.uppercase() } }, ) fun TypeForm.toTypeRequest(): Type.Request = Type.Request(