Files
markbase/markbase-smb/src/config.rs
Warren d94cb2df4c 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
2026-06-19 05:21:38 +08:00

50 lines
1.4 KiB
Rust

use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SMBConfig {
pub share_name: String,
pub path: String,
pub comment: String,
pub read_only: bool,
pub browseable: bool,
pub allow_users: Vec<String>,
}
impl Default for SMBConfig {
fn default() -> Self {
SMBConfig {
share_name: "markbase".to_string(),
path: "/Users/accusys/momentry/var/sftpgo/data".to_string(),
comment: "MarkBase File Sharing".to_string(),
read_only: false,
browseable: true,
allow_users: vec!["accusys".to_string()],
}
}
}
impl SMBConfig {
pub fn new(share_name: String, path: String) -> Self {
SMBConfig {
share_name,
path,
comment: "MarkBase File Sharing".to_string(),
read_only: false,
browseable: true,
allow_users: vec!["accusys".to_string()],
}
}
pub fn to_smb_conf(&self) -> String {
format!(
"[{}]\n path = {}\n comment = {}\n read only = {}\n browseable = {}\n valid users = {}\n",
self.share_name,
self.path,
self.comment,
if self.read_only { "yes" } else { "no" },
if self.browseable { "yes" } else { "no" },
self.allow_users.join(", ")
)
}
}