RpcEnvironment: implement set_user() and get_user()
This commit is contained in:
@ -5,11 +5,15 @@ use serde_json::Value;
|
||||
|
||||
pub struct CliEnvironment {
|
||||
result_attributes: HashMap<String, Value>,
|
||||
user: Option<String>,
|
||||
}
|
||||
|
||||
impl CliEnvironment {
|
||||
pub fn new() -> Self {
|
||||
Self { result_attributes: HashMap::new() }
|
||||
Self {
|
||||
result_attributes: HashMap::new(),
|
||||
user: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,4 +31,11 @@ impl RpcEnvironment for CliEnvironment {
|
||||
RpcEnvironmentType::CLI
|
||||
}
|
||||
|
||||
fn set_user(&mut self, user: Option<String>) {
|
||||
self.user = user;
|
||||
}
|
||||
|
||||
fn get_user(&self) -> Option<String> {
|
||||
self.user.clone()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user