2019-11-17 18:44:01 +01:00
|
|
|
require "csv"
|
|
|
|
|
|
|
|
class Passwd::Group
|
2020-01-04 09:09:37 +01:00
|
|
|
property name : String
|
|
|
|
property password_hash : String
|
|
|
|
property gid : Int32
|
|
|
|
property users = Array(String).new
|
2019-11-17 18:44:01 +01:00
|
|
|
|
|
|
|
def initialize(@name, @password_hash, @gid, @users = [] of String)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(line : Array(String))
|
|
|
|
@name = line[0]
|
|
|
|
@password_hash = line[1]
|
|
|
|
@gid = line[2].to_i
|
|
|
|
|
|
|
|
@users = line[3].split ","
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_csv
|
|
|
|
[@name, @password_hash, @gid, @users.join ","].join ":"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|