diff --git a/src/passwd.cr b/src/passwd.cr index 2fae9a1..ebc5f0f 100644 --- a/src/passwd.cr +++ b/src/passwd.cr @@ -145,7 +145,17 @@ class Passwd digest.hexdigest end - def add_user(login, password = nil, uid = nil, gid = nil, home = "/", shell = "/bin/nologin") + def add_user(login, + password = nil, + uid = nil, + gid = nil, + home = "/", + shell = "/bin/nologin", + full_name = nil, + location = nil, + office_phone_number = nil, + home_phone_number = nil, + other_contact = nil) # FIXME: If user already exists, exception? Replacement? uid = get_free_uid if uid.nil? @@ -158,7 +168,12 @@ class Passwd "x" end - user = Passwd::User.new login, password_hash, uid, gid, home, shell + user = Passwd::User.new(login, password_hash, uid, gid, home, shell, + full_name: full_name, + location: location, + office_phone_number: office_phone_number, + home_phone_number: home_phone_number, + other_contact: other_contact) File.write(@passwd, user.to_csv + "\n", mode: "a")