authd/src/user.cr

42 lines
723 B
Crystal
Raw Normal View History

2019-05-29 15:30:23 +02:00
require "json"
2019-11-17 15:50:26 +01:00
require "./passwd.cr"
2019-11-17 15:50:26 +01:00
class Passwd::User
JSON.mapping({
login: String,
password_hash: String,
uid: Int32,
gid: Int32,
home: String,
shell: String,
groups: Array(String),
full_name: String?,
office_phone_number: String?,
home_phone_number: String?,
2019-05-29 19:45:03 +02:00
other_contact: String?,
})
def sanitize!
@password_hash = "x"
self
end
def to_h
{
:login => @login,
:password_hash => "x", # Not real hash in JWT.
:uid => @uid,
:gid => @gid,
:home => @home,
:shell => @shell,
:groups => @groups,
:full_name => @full_name,
:office_phone_number => @office_phone_number,
:home_phone_number => @home_phone_number,
2019-11-17 15:50:26 +01:00
:other_contact => @other_contact
}
end
end