rpcenv: rename user to auth_id

since it does no longer store just a userid, but potentially an API
token identifier as well

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2020-10-28 12:36:24 +01:00 committed by Wolfgang Bumiller
parent 7d34e6f3a4
commit 51f5acea22
2 changed files with 9 additions and 9 deletions

View File

@ -6,7 +6,7 @@ use crate::api::{RpcEnvironment, RpcEnvironmentType};
#[derive(Default)]
pub struct CliEnvironment {
result_attributes: Value,
user: Option<String>,
auth_id: Option<String>,
}
impl CliEnvironment {
@ -28,11 +28,11 @@ impl RpcEnvironment for CliEnvironment {
RpcEnvironmentType::CLI
}
fn set_user(&mut self, user: Option<String>) {
self.user = user;
fn set_auth_id(&mut self, auth_id: Option<String>) {
self.auth_id = auth_id;
}
fn get_user(&self) -> Option<String> {
self.user.clone()
fn get_auth_id(&self) -> Option<String> {
self.auth_id.clone()
}
}

View File

@ -14,11 +14,11 @@ pub trait RpcEnvironment: std::any::Any + AsAny + Send {
/// The environment type
fn env_type(&self) -> RpcEnvironmentType;
/// Set user name
fn set_user(&mut self, user: Option<String>);
/// Set authentication id
fn set_auth_id(&mut self, user: Option<String>);
/// Get user name
fn get_user(&self) -> Option<String>;
/// Get authentication id
fn get_auth_id(&self) -> Option<String>;
/// Set the client IP, should be re-set if a proxied connection was detected
fn set_client_ip(&mut self, _client_ip: Option<std::net::SocketAddr>) {