class Serverkit::Resources::User
Public Instance Methods
Source
# File lib/serverkit/resources/user.rb, line 18 def apply if has_correct_user? update_user_encrypted_password unless has_correct_password? update_user_gid unless has_correct_gid? update_user_home_directory unless has_correct_home_directory? update_user_login_shell unless has_correct_login_shell? update_user_uid unless has_correct_uid? else add_user end end
@note Override
Source
# File lib/serverkit/resources/user.rb, line 31 def check if !has_correct_user? false elsif !has_correct_gid? false elsif !has_correct_home_directory? false elsif !has_correct_password? false elsif !has_correct_login_shell? false elsif !has_correct_uid? false else true end end
@note Override
Private Instance Methods
Source
# File lib/serverkit/resources/user.rb, line 51 def add_user run_command_from_identifier( :add_user, name, gid: gid, home_directory: home, password: encrypted_password, shell: shell, system_user: system, uid: uid, ) end
Source
# File lib/serverkit/resources/user.rb, line 65 def encrypted_password unless password.nil? @encrypted_password ||= UnixCrypt::SHA512.build(password) end end
@return [String, nil]
Source
# File lib/serverkit/resources/user.rb, line 71 def get_remote_encrypted_password run_command_from_identifier(:get_user_encrypted_password, name).stdout end
Source
# File lib/serverkit/resources/user.rb, line 75 def has_correct_gid? gid.nil? || check_command_from_identifier(:check_user_belongs_to_group, name, gid) end
Source
# File lib/serverkit/resources/user.rb, line 79 def has_correct_home_directory? home.nil? || check_command_from_identifier(:check_user_has_home_directory, name, home) end
Source
# File lib/serverkit/resources/user.rb, line 83 def has_correct_login_shell? shell.nil? || check_command_from_identifier(:check_user_has_login_shell, name, shell) end
Source
# File lib/serverkit/resources/user.rb, line 87 def has_correct_password? password.nil? || ::UnixCrypt.valid?(password, get_remote_encrypted_password) end
Source
# File lib/serverkit/resources/user.rb, line 91 def has_correct_uid? uid.nil? || check_command_from_identifier(:check_user_has_uid, name, uid) end
Source
# File lib/serverkit/resources/user.rb, line 95 def has_correct_user? check_command_from_identifier(:check_user_exists, name) end
Source
# File lib/serverkit/resources/user.rb, line 99 def update_user_encrypted_password run_command_from_identifier(:update_user_encrypted_password, name, encrypted_password) end
Source
# File lib/serverkit/resources/user.rb, line 103 def update_user_gid run_command_from_identifier(:update_user_gid, name, gid) end
Source
# File lib/serverkit/resources/user.rb, line 107 def update_user_home_directory run_command_from_identifier(:update_user_home_directory, name, home) end
Source
# File lib/serverkit/resources/user.rb, line 111 def update_user_login_shell run_command_from_identifier(:update_user_login_shell, name, shell) end
Source
# File lib/serverkit/resources/user.rb, line 115 def update_user_uid run_command_from_identifier(:update_user_uid, name, uid) end