Class: DInstaller::DBus::Clients::Users

Inherits:
Base
  • Object
show all
Includes:
WithServiceStatus
Defined in:
lib/dinstaller/dbus/clients/users.rb

Overview

D-Bus client for users configuration

Instance Method Summary collapse

Methods included from WithServiceStatus

#on_service_status_change, #service_status, #to_service_status

Methods inherited from Base

#service

Constructor Details

#initializeUsers

Returns a new instance of Users.



32
33
34
35
36
37
# File 'lib/dinstaller/dbus/clients/users.rb', line 32

def initialize
  super

  @dbus_object = service["/org/opensuse/DInstaller/Users1"]
  @dbus_object.introspect
end

Instance Method Details

#create_first_user(name, fullname: nil, password: nil, autologin: false) ⇒ Object

Configures the first user to create during the installation

Parameters:

  • name (String)
  • fullname (String, nil) (defaults to: nil)
  • password (String, nil) (defaults to: nil)
  • autologin (Boolean) (defaults to: false)


57
58
59
# File 'lib/dinstaller/dbus/clients/users.rb', line 57

def create_first_user(name, fullname: nil, password: nil, autologin: false)
  dbus_object.SetFirstUser(fullname.to_s, name, password.to_s, !!autologin, {})
end

#first_userArray<String, String, Boolean>

Configuration of the first user to create during the installation

Returns:

  • (Array<String, String, Boolean>)

    full name, name and autologin



47
48
49
# File 'lib/dinstaller/dbus/clients/users.rb', line 47

def first_user
  dbus_object["org.opensuse.DInstaller.Users1"]["FirstUser"][0..2]
end

#remove_first_userObject

Removes the configuration of the first user



62
63
64
# File 'lib/dinstaller/dbus/clients/users.rb', line 62

def remove_first_user
  dbus_object.RemoveFirstUser
end

#remove_root_infoObject

Removes the SSH key and password for root



95
96
97
98
# File 'lib/dinstaller/dbus/clients/users.rb', line 95

def remove_root_info
  dbus_object.RemoveRootPassword
  dbus_object.SetRootSSHKey("")
end

#root_password=(value) ⇒ Object

Sets the root password

Parameters:

  • value (String)


90
91
92
# File 'lib/dinstaller/dbus/clients/users.rb', line 90

def root_password=(value)
  dbus_object.SetRootPassword(value, false)
end

#root_password?Boolean

Whether the root password is set

Returns:

  • (Boolean)


83
84
85
# File 'lib/dinstaller/dbus/clients/users.rb', line 83

def root_password?
  dbus_object["org.opensuse.DInstaller.Users1"]["RootPasswordSet"]
end

#root_ssh_keyString

SSH key for root

Returns:

  • (String)

    empty if no SSH key set



69
70
71
# File 'lib/dinstaller/dbus/clients/users.rb', line 69

def root_ssh_key
  dbus_object["org.opensuse.DInstaller.Users1"]["RootSSHKey"]
end

#root_ssh_key=(value) ⇒ Object

Sets the SSH key for root

Parameters:

  • value (String)


76
77
78
# File 'lib/dinstaller/dbus/clients/users.rb', line 76

def root_ssh_key=(value)
  dbus_object.SetRootSSHKey(value)
end

#service_nameString

Returns:

  • (String)


40
41
42
# File 'lib/dinstaller/dbus/clients/users.rb', line 40

def service_name
  @service_name ||= "org.opensuse.DInstaller.Users"
end

#writeObject

Commit the changes



101
102
103
# File 'lib/dinstaller/dbus/clients/users.rb', line 101

def write
  dbus_object.Write
end