From 9482e858218afcb720840ce748c22afc75aae380 Mon Sep 17 00:00:00 2001 From: dietrich Date: Fri, 16 Oct 2020 13:19:32 +0200 Subject: [PATCH] add rough api draft --- src/api.rs | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/src/api.rs b/src/api.rs index 8c15df4..1914170 100644 --- a/src/api.rs +++ b/src/api.rs @@ -15,9 +15,9 @@ trait UserDBValidation { } trait UserDBWrite { - fn set_user(&self) -> Option; + fn delete_user(&self) -> Option; fn new_user(&self) -> Option; - fn set_group(&self) -> Option; + fn delete_group(&self) -> Option; fn new_group(&self) -> Option; } @@ -25,11 +25,43 @@ trait UserRead { fn get_username(&self) -> Option; fn get_uid(&self) -> Option; fn get_gid(&self) -> Option; - // … + fn get_password(&self) -> Option; + fn get_gecos(&self) -> Option; + fn get_home_dir(&self) -> Option; + fn get_shell_path(&self) -> Option; + fn get_full_name(&self) -> Option; + fn get_room(&self) -> Option; + fn get_phone_work(&self) -> Option; + fn get_phone_home(&self) -> Option; + fn get_other(&self) -> Option>; } -trait UserWrite {} +trait UserWrite { + fn set_username(&self) -> Option; + fn set_uid(&self) -> Option; + fn set_gid(&self) -> Option; + fn set_password(&self) -> Option; + fn set_gecos(&self) -> Option; + fn set_home_dir(&self) -> Option; + fn set_shell_path(&self) -> Option; + fn set_full_name(&self) -> Option; + fn set_room(&self) -> Option; + fn set_phone_work(&self) -> Option; + fn set_phone_home(&self) -> Option; + fn set_other(&self) -> Option>; +} -trait GroupRead {} +trait GroupRead { + fn get_groupname(&self) -> Option; + fn get_encrypted_password(&self) -> Option; + fn get_gid(&self) -> Option; + fn get_members(&self) -> Option; +} -trait GroupWrite {} +trait GroupWrite { + fn set_groupname(&self) -> Option; + fn set_password(&self) -> Option; + fn set_gid(&self) -> Option; + fn add_member(user: T) -> Option; + fn remove_member(user: T) -> Option; +}