@@ -32,6 +32,9 @@ use tokio::sync::Mutex;
32
32
// async aware lock for updating storage metadata and user map atomicically
33
33
static UPDATE_LOCK : Mutex < ( ) > = Mutex :: const_new ( ( ) ) ;
34
34
35
+ // Handler for POST /api/v1/user/create/{username}
36
+ // Creates a new user by username
37
+ // returns password generated for this user
35
38
pub async fn put_user ( username : web:: Path < String > ) -> Result < impl Responder , RBACError > {
36
39
let username = username. into_inner ( ) ;
37
40
validator:: verify_username ( & username) ?;
@@ -57,6 +60,9 @@ pub async fn put_user(username: web::Path<String>) -> Result<impl Responder, RBA
57
60
Ok ( password)
58
61
}
59
62
63
+ // Handler for POST /api/v1/user/reset/{username}
64
+ // Reset password for given username
65
+ // returns new password generated for this user
60
66
pub async fn reset_password ( username : web:: Path < String > ) -> Result < impl Responder , RBACError > {
61
67
let username = username. into_inner ( ) ;
62
68
let _ = UPDATE_LOCK . lock ( ) . await ;
@@ -91,6 +97,7 @@ pub async fn reset_password(username: web::Path<String>) -> Result<impl Responde
91
97
Ok ( password)
92
98
}
93
99
100
+ // Handler for DELETE /api/v1/user/delete/{username}
94
101
pub async fn delete_user ( username : web:: Path < String > ) -> Result < impl Responder , RBACError > {
95
102
let username = username. into_inner ( ) ;
96
103
let _ = UPDATE_LOCK . lock ( ) . await ;
0 commit comments