commit 3f175df5ce0be03e1c09f0a62e0c4236f92f4fc6
parent c696a3748b72eb5eb83f576885b3ea28d9c814bc
Author: MS <ms@taler.net>
Date: Wed, 8 Feb 2023 14:17:51 +0100
implementing #7521
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
@@ -66,7 +66,8 @@ data class CircuitContactData(
data class CircuitAccountReconfiguration(
val contact_data: CircuitContactData,
- val cashout_address: String
+ val cashout_address: String,
+ val name: String? = null
)
data class AccountPasswordChange(
@@ -530,6 +531,10 @@ fun circuitApi(circuitRoute: Route) {
allowOwnerOrAdmin(username, resourceName)
// account found and authentication succeeded
val req = call.receive<CircuitAccountReconfiguration>()
+ // Only admin's allowed to change the legal name
+ if (req.name != null && username != "admin") throw forbidden(
+ "Only admin can change the user legal name"
+ )
if ((req.contact_data.email != null) && (!checkEmailAddress(req.contact_data.email)))
throw badRequest("Invalid e-mail address: ${req.contact_data.email}")
if ((req.contact_data.phone != null) && (!checkPhoneNumber(req.contact_data.phone)))