MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / get

Method get

chirpstack/src/api/user.rs:83–114  ·  view source on GitHub ↗
(
        &self,
        request: Request<api::GetUserRequest>,
    )

Source from the content-addressed store, hash-verified

81 }
82
83 async fn get(
84 &self,
85 request: Request<api::GetUserRequest>,
86 ) -> Result<Response<api::GetUserResponse>, Status> {
87 let req = request.get_ref();
88 let user_id = Uuid::from_str(&req.id).map_err(|e| e.status())?;
89
90 self.validator
91 .validate(
92 request.extensions(),
93 validator::ValidateUserAccess::new(validator::Flag::Read, user_id),
94 )
95 .await?;
96
97 let u = user::get(&user_id).await.map_err(|e| e.status())?;
98
99 let mut resp = Response::new(api::GetUserResponse {
100 user: Some(api::User {
101 id: u.id.to_string(),
102 is_admin: u.is_admin,
103 is_active: u.is_active,
104 email: u.email.clone(),
105 note: u.note.clone(),
106 }),
107 created_at: Some(helpers::datetime_to_prost_timestamp(&u.created_at)),
108 updated_at: Some(helpers::datetime_to_prost_timestamp(&u.updated_at)),
109 });
110 resp.metadata_mut()
111 .insert("x-log-user_id", req.id.parse().unwrap());
112
113 Ok(resp)
114 }
115
116 async fn update(
117 &self,

Callers 15

getFunction · 0.45
send_attributesMethod · 0.45
send_telemetryMethod · 0.45
newMethod · 0.45
newMethod · 0.45
parse_tokenMethod · 0.45
assert_replyFunction · 0.45
uplink_eventMethod · 0.45
newMethod · 0.45
uplink_eventMethod · 0.45
join_eventMethod · 0.45

Calls 7

statusMethod · 0.80
to_stringMethod · 0.80
insertMethod · 0.80
unwrapMethod · 0.80
getFunction · 0.50
validateMethod · 0.45

Tested by 2

test_userFunction · 0.36
test_log_requestFunction · 0.36