From 1035527579e96cfceddbf4d10c877417047e5920 Mon Sep 17 00:00:00 2001 From: Satyam Singh Date: Tue, 8 Aug 2023 13:03:17 +0530 Subject: [PATCH] Attach role to newly created user if provided --- server/src/handlers/http/rbac.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/src/handlers/http/rbac.rs b/server/src/handlers/http/rbac.rs index 49ccb158f..5bc1c4015 100644 --- a/server/src/handlers/http/rbac.rs +++ b/server/src/handlers/http/rbac.rs @@ -45,7 +45,10 @@ pub async fn list_users() -> impl Responder { // Creates a new user by username if it does not exists // Otherwise make a call to reset password // returns password generated for this user -pub async fn put_user(username: web::Path) -> Result { +pub async fn put_user( + username: web::Path, + body: Option>, +) -> Result { let username = username.into_inner(); validator::user_name(&username)?; if username == CONFIG.parseable.username { @@ -60,13 +63,16 @@ pub async fn put_user(username: web::Path) -> Result::from(username), body).await?; + } + Ok(password) } }