renaming the project adduser -> umanux
This commit is contained in:
parent
05cbd2d139
commit
5a678bc3d5
32
Cargo.lock
generated
32
Cargo.lock
generated
@ -1,21 +1,5 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "adduser"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"derive_builder",
|
||||
"env_logger",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"regex",
|
||||
"simplelog",
|
||||
"tempfile",
|
||||
"test_bin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.13"
|
||||
@ -501,6 +485,22 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "umanux"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"derive_builder",
|
||||
"env_logger",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"regex",
|
||||
"simplelog",
|
||||
"tempfile",
|
||||
"test_bin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.6.0"
|
||||
|
@ -1,13 +1,13 @@
|
||||
[package]
|
||||
name = "adduser"
|
||||
name = "umanux"
|
||||
version = "0.1.0"
|
||||
description = "Library for managing Linux users and their directories"
|
||||
authors = ["Dietrich <dietrich@teilgedanken.de>"]
|
||||
edition = "2018"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["user", "admin", "linux", "manage"]
|
||||
categories = ["system-tools", "system-tools::user-management"]
|
||||
repository = "https://git.teilgedanken.de/Rust/useradd/"
|
||||
keywords = ["user", "admin", "linux", "manage", "passwd"]
|
||||
categories = ["os", "os::linux-apis", "parser-implementations", "command-line-utilities"]
|
||||
repository = "https://github.com/umanux/umanux"
|
||||
readme = "README.md"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@ -3,8 +3,8 @@ use std::path::PathBuf;
|
||||
extern crate clap;
|
||||
use clap::{App, Arg};
|
||||
|
||||
extern crate adduser;
|
||||
use adduser::{api::UserDBWrite, UserLibError};
|
||||
extern crate umanux;
|
||||
use umanux::{api::UserDBWrite, UserLibError};
|
||||
|
||||
fn main() -> Result<(), UserLibError> {
|
||||
env_logger::init();
|
||||
@ -48,18 +48,18 @@ fn main() -> Result<(), UserLibError> {
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
let mf = adduser::Files {
|
||||
let mf = umanux::Files {
|
||||
passwd: Some(PathBuf::from(matches.value_of("passwd").unwrap())),
|
||||
shadow: Some(PathBuf::from(matches.value_of("shadow").unwrap())),
|
||||
group: Some(PathBuf::from(matches.value_of("group").unwrap())),
|
||||
};
|
||||
|
||||
let mut db = adduser::UserDBLocal::load_files(mf).unwrap();
|
||||
let mut db = umanux::UserDBLocal::load_files(mf).unwrap();
|
||||
|
||||
match db.new_user(
|
||||
adduser::api::CreateUserArgs::builder()
|
||||
umanux::api::CreateUserArgs::builder()
|
||||
.username(matches.value_of("username").unwrap())
|
||||
// .delete_home(adduser::api::DeleteHome::Delete)
|
||||
// .delete_home(umanux::api::DeleteHome::Delete)
|
||||
.build()
|
||||
.unwrap(),
|
||||
) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
extern crate adduser;
|
||||
extern crate umanux;
|
||||
|
||||
use adduser::api::UserDBWrite;
|
||||
use adduser::api::UserRead;
|
||||
use umanux::api::UserDBWrite;
|
||||
use umanux::api::UserRead;
|
||||
|
||||
extern crate env_logger;
|
||||
#[allow(unused_imports)]
|
||||
@ -12,18 +12,18 @@ use log::{debug, error, info, trace, warn};
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
|
||||
let mf = adduser::Files {
|
||||
let mf = umanux::Files {
|
||||
passwd: Some(PathBuf::from("./passwd")),
|
||||
shadow: Some(PathBuf::from("./shadow")),
|
||||
group: Some(PathBuf::from("./group")),
|
||||
};
|
||||
|
||||
let mut db = adduser::UserDBLocal::load_files(mf).unwrap();
|
||||
let mut db = umanux::UserDBLocal::load_files(mf).unwrap();
|
||||
|
||||
let user_res: Result<adduser::User, adduser::UserLibError> = db.delete_user(
|
||||
adduser::api::DeleteUserArgs::builder()
|
||||
let user_res: Result<umanux::User, umanux::UserLibError> = db.delete_user(
|
||||
umanux::api::DeleteUserArgs::builder()
|
||||
.username("teste")
|
||||
// .delete_home(adduser::api::DeleteHome::Delete)
|
||||
// .delete_home(umanux::api::DeleteHome::Delete)
|
||||
.build()
|
||||
.unwrap(),
|
||||
);
|
||||
|
@ -1,5 +1,5 @@
|
||||
extern crate adduser;
|
||||
use adduser::api::UserDBRead;
|
||||
extern crate umanux;
|
||||
use umanux::api::UserDBRead;
|
||||
|
||||
fn main() {
|
||||
simplelog::CombinedLogger::init(vec![simplelog::TermLogger::new(
|
||||
@ -9,7 +9,7 @@ fn main() {
|
||||
)])
|
||||
.unwrap();
|
||||
|
||||
let db = adduser::UserDBLocal::load_files(adduser::Files::default()).unwrap();
|
||||
let db = umanux::UserDBLocal::load_files(umanux::Files::default()).unwrap();
|
||||
|
||||
for u in db.get_all_users() {
|
||||
println!("{}", u);
|
||||
|
@ -106,9 +106,9 @@ impl NewFromString for Group {
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use crate::adduser::api::GroupRead;
|
||||
/// use adduser::NewFromString;
|
||||
/// let grp = adduser::Group::new_from_string(
|
||||
/// use crate::umanux::api::GroupRead;
|
||||
/// use umanux::NewFromString;
|
||||
/// let grp = umanux::Group::new_from_string(
|
||||
/// "teste:x:1002:test,teste".to_owned(),
|
||||
/// 0,
|
||||
/// ).unwrap();
|
||||
|
@ -73,9 +73,9 @@ impl NewFromString for User {
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use crate::adduser::api::UserRead;
|
||||
/// use adduser::NewFromString;
|
||||
/// let pwd = adduser::User::new_from_string(
|
||||
/// use crate::umanux::api::UserRead;
|
||||
/// use umanux::NewFromString;
|
||||
/// let pwd = umanux::User::new_from_string(
|
||||
/// "testuser:testpassword:1001:1001:full Name,,,,:/home/test:/bin/test".to_string(), 0).unwrap();
|
||||
/// assert_eq!(pwd.get_username().unwrap(), "testuser");
|
||||
/// ```
|
||||
|
@ -88,8 +88,8 @@ impl NewFromString for Shadow {
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use adduser::NewFromString;
|
||||
/// let shad = adduser::Shadow::new_from_string(
|
||||
/// use umanux::NewFromString;
|
||||
/// let shad = umanux::Shadow::new_from_string(
|
||||
/// "test:!!$6$/RotIe4VZzzAun4W$7YUONvru1rDnllN5TvrnOMsWUD5wSDUPAD6t6/Xwsr/0QOuWF3HcfAhypRkGa8G1B9qqWV5kZSnCb8GKMN9N61:18260:0:99999:7:::".to_string(),
|
||||
/// 0,
|
||||
/// ).unwrap();
|
||||
|
@ -1,14 +1,14 @@
|
||||
extern crate adduser;
|
||||
extern crate test_bin;
|
||||
extern crate umanux;
|
||||
mod testfiles;
|
||||
|
||||
#[test]
|
||||
fn test_create_user_function() {
|
||||
use testfiles::Fixture;
|
||||
|
||||
use adduser::api::UserDBWrite;
|
||||
use adduser::api::UserRead;
|
||||
use std::fs;
|
||||
use umanux::api::UserDBWrite;
|
||||
use umanux::api::UserRead;
|
||||
|
||||
let p = Fixture::copy("passwd");
|
||||
let s = Fixture::copy("shadow");
|
||||
@ -16,18 +16,18 @@ fn test_create_user_function() {
|
||||
|
||||
let pf = fs::read_to_string(&p.path).unwrap();
|
||||
|
||||
let mf = adduser::Files {
|
||||
let mf = umanux::Files {
|
||||
passwd: Some(p.path.clone()),
|
||||
shadow: Some(s.path),
|
||||
group: Some(g.path),
|
||||
};
|
||||
|
||||
let mut db = adduser::UserDBLocal::load_files(mf).unwrap();
|
||||
let mut db = umanux::UserDBLocal::load_files(mf).unwrap();
|
||||
|
||||
let user_res: Result<&adduser::User, adduser::UserLibError> = db.new_user(
|
||||
adduser::api::CreateUserArgs::builder()
|
||||
let user_res: Result<&umanux::User, umanux::UserLibError> = db.new_user(
|
||||
umanux::api::CreateUserArgs::builder()
|
||||
.username("test2")
|
||||
// .delete_home(adduser::api::DeleteHome::Delete)
|
||||
// .delete_home(umanux::api::DeleteHome::Delete)
|
||||
.build()
|
||||
.unwrap(),
|
||||
);
|
||||
|
@ -1,13 +1,13 @@
|
||||
extern crate adduser;
|
||||
extern crate umanux;
|
||||
mod testfiles;
|
||||
|
||||
#[test]
|
||||
fn test_delete_user_function() {
|
||||
use testfiles::Fixture;
|
||||
|
||||
use adduser::api::UserDBWrite;
|
||||
use adduser::api::UserRead;
|
||||
use std::fs;
|
||||
use umanux::api::UserDBWrite;
|
||||
use umanux::api::UserRead;
|
||||
|
||||
let p = Fixture::copy("passwd");
|
||||
let s = Fixture::copy("shadow");
|
||||
@ -15,18 +15,18 @@ fn test_delete_user_function() {
|
||||
|
||||
let pf = fs::read_to_string(&p.path).unwrap();
|
||||
|
||||
let mf = adduser::Files {
|
||||
let mf = umanux::Files {
|
||||
passwd: Some(p.path.clone()),
|
||||
shadow: Some(s.path),
|
||||
group: Some(g.path),
|
||||
};
|
||||
|
||||
let mut db = adduser::UserDBLocal::load_files(mf).unwrap();
|
||||
let mut db = umanux::UserDBLocal::load_files(mf).unwrap();
|
||||
|
||||
let user_res: Result<adduser::User, adduser::UserLibError> = db.delete_user(
|
||||
adduser::api::DeleteUserArgs::builder()
|
||||
let user_res: Result<umanux::User, umanux::UserLibError> = db.delete_user(
|
||||
umanux::api::DeleteUserArgs::builder()
|
||||
.username("teste")
|
||||
// .delete_home(adduser::api::DeleteHome::Delete)
|
||||
// .delete_home(umanux::api::DeleteHome::Delete)
|
||||
.build()
|
||||
.unwrap(),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user