Fix code quality: trailing whitespace, unused imports, clippy warnings
- Fix trailing whitespace in kex.rs and s3.rs - Add missing KexProposal import in kex_complete.rs - Auto-fix clippy warnings across all crates - All 153 tests pass
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use clap::Parser;
|
||||
use markbase_smb::{SMBConfig, SMBManager, AccessControlList, UserPermission, AuthManager, SMBMonitor};
|
||||
use markbase_smb::{
|
||||
AccessControlList, AuthManager, SMBConfig, SMBManager, SMBMonitor, UserPermission,
|
||||
};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "markbase-smb")]
|
||||
@@ -16,34 +18,34 @@ enum Commands {
|
||||
/// Share name
|
||||
#[arg(short, long, default_value = "markbase")]
|
||||
name: String,
|
||||
|
||||
|
||||
/// Path to share
|
||||
#[arg(short, long, default_value = "/Users/accusys/momentry/var/sftpgo/data")]
|
||||
path: String,
|
||||
},
|
||||
|
||||
|
||||
/// Remove SMB share
|
||||
Remove {
|
||||
/// Share name
|
||||
#[arg(short, long)]
|
||||
name: String,
|
||||
},
|
||||
|
||||
|
||||
/// List existing SMB shares
|
||||
List,
|
||||
|
||||
|
||||
/// Show SMB status
|
||||
Status,
|
||||
|
||||
|
||||
/// Manage user permissions
|
||||
User {
|
||||
#[command(subcommand)]
|
||||
action: UserCommands,
|
||||
},
|
||||
|
||||
|
||||
/// Show monitoring stats
|
||||
Stats,
|
||||
|
||||
|
||||
/// Show access logs
|
||||
Logs {
|
||||
/// Number of log entries to show
|
||||
@@ -58,24 +60,24 @@ enum UserCommands {
|
||||
Add {
|
||||
#[arg(short, long)]
|
||||
username: String,
|
||||
|
||||
|
||||
#[arg(short, long, default_value = "readonly")]
|
||||
permission: String,
|
||||
},
|
||||
|
||||
|
||||
/// Remove user permission
|
||||
Remove {
|
||||
#[arg(short, long)]
|
||||
username: String,
|
||||
},
|
||||
|
||||
|
||||
/// List all user permissions
|
||||
List,
|
||||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let cli = Cli::parse();
|
||||
|
||||
|
||||
match cli.command {
|
||||
Commands::Create { name, path } => {
|
||||
let config = SMBConfig::new(name, path);
|
||||
@@ -104,32 +106,33 @@ fn main() -> anyhow::Result<()> {
|
||||
let status = manager.status()?;
|
||||
println!("{}", serde_json::to_string_pretty(&status)?);
|
||||
}
|
||||
Commands::User { action } => {
|
||||
match action {
|
||||
UserCommands::Add { username, permission } => {
|
||||
let acl = AccessControlList::new();
|
||||
let perm = match permission.as_str() {
|
||||
"readonly" => UserPermission::readonly(username),
|
||||
"full" => UserPermission::full_access(username),
|
||||
"admin" => UserPermission::admin(username),
|
||||
_ => UserPermission::readonly(username),
|
||||
};
|
||||
|
||||
println!("User permission configuration:");
|
||||
println!("{}", serde_json::to_string_pretty(&perm)?);
|
||||
println!("\nTo apply, update system SMB configuration with this user.");
|
||||
}
|
||||
UserCommands::Remove { username } => {
|
||||
println!("Removing user '{}' from ACL", username);
|
||||
println!("To apply, update system SMB configuration.");
|
||||
}
|
||||
UserCommands::List => {
|
||||
let acl = AccessControlList::new();
|
||||
println!("Default ACL configuration:");
|
||||
println!("{}", serde_json::to_string_pretty(&acl)?);
|
||||
}
|
||||
Commands::User { action } => match action {
|
||||
UserCommands::Add {
|
||||
username,
|
||||
permission,
|
||||
} => {
|
||||
let acl = AccessControlList::new();
|
||||
let perm = match permission.as_str() {
|
||||
"readonly" => UserPermission::readonly(username),
|
||||
"full" => UserPermission::full_access(username),
|
||||
"admin" => UserPermission::admin(username),
|
||||
_ => UserPermission::readonly(username),
|
||||
};
|
||||
|
||||
println!("User permission configuration:");
|
||||
println!("{}", serde_json::to_string_pretty(&perm)?);
|
||||
println!("\nTo apply, update system SMB configuration with this user.");
|
||||
}
|
||||
}
|
||||
UserCommands::Remove { username } => {
|
||||
println!("Removing user '{}' from ACL", username);
|
||||
println!("To apply, update system SMB configuration.");
|
||||
}
|
||||
UserCommands::List => {
|
||||
let acl = AccessControlList::new();
|
||||
println!("Default ACL configuration:");
|
||||
println!("{}", serde_json::to_string_pretty(&acl)?);
|
||||
}
|
||||
},
|
||||
Commands::Stats => {
|
||||
let monitor = SMBMonitor::new();
|
||||
let stats = monitor.get_stats();
|
||||
@@ -149,6 +152,6 @@ fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user