Class: Yast::AutologinClass
- Inherits:
-
Module
- Object
- Module
- Yast::AutologinClass
- Defined in:
- ../../src/modules/Autologin.rb
Instance Method Summary (collapse)
-
- (Object) AskForDisabling(new)
Ask if autologin should be disabled (and disable it in such case).
-
- (Object) Disable
Disable autologin.
-
- (Object) DisableAndWrite(write_only)
Disable autologin and write it (used probably for automatic disabling without asking).
- - (Object) main
-
- (Object) Read
Read autologin settings.
-
- (Object) Use(use)
Wrapper for setting the 'used' variable.
-
- (Object) Write(write_only)
Write autologin settings.
Instance Method Details
- (Object) AskForDisabling(new)
Ask if autologin should be disabled (and disable it in such case)
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File '../../src/modules/Autologin.rb', line 142 def AskForDisabling(new) # popup text (%1 is user name, %2 is additional info, # like "Now LDAP was enabled") question = Builtins.sformat( _( "The automatic login feature is enabled for user %1.\n" + "%2\n" + "Disable automatic login?" ), @user, new ) Disable() if @used && Popup.YesNo(question) @used end |
- (Object) Disable
Disable autologin
111 112 113 114 115 116 117 118 |
# File '../../src/modules/Autologin.rb', line 111 def Disable @user = "" @pw_less = false @used = false @modified = true nil end |
- (Object) DisableAndWrite(write_only)
Disable autologin and write it (used probably for automatic disabling without asking)
134 135 136 137 |
# File '../../src/modules/Autologin.rb', line 134 def DisableAndWrite(write_only) Disable() Write(write_only) end |
- (Object) main
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File '../../src/modules/Autologin.rb', line 33 def main textdomain "pam" Yast.import "Package" Yast.import "Popup" # User to log in automaticaly @user = "" # Login without passwords? @pw_less = false # Is autologin feature available? @available = true # Is autogion used? Usualy true when user is not empty, but for the first # time (during installation), this can be true by default although user is "" # (depends on the control file) @used = false # Autologin settings modified? @modified = false end |
- (Object) Read
Read autologin settings
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File '../../src/modules/Autologin.rb', line 59 def Read if SCR.Read(path(".target.size"), "/etc/sysconfig/displaymanager") == -1 @available = false @user = "" @used = false return false end @available = true @user = Convert.to_string( SCR.Read(path(".sysconfig.displaymanager.DISPLAYMANAGER_AUTOLOGIN")) ) @pw_less = Convert.to_string( SCR.Read( path(".sysconfig.displaymanager.DISPLAYMANAGER_PASSWORD_LESS_LOGIN") ) ) == "yes" @user = "" if @user == nil || @user == "" @used = @user != "" @used end |
- (Object) Use(use)
Wrapper for setting the 'used' variable
121 122 123 124 125 126 127 128 |
# File '../../src/modules/Autologin.rb', line 121 def Use(use) if @used != use @used = use @modified = true end nil end |
- (Object) Write(write_only)
Write autologin settings
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File '../../src/modules/Autologin.rb', line 87 def Write(write_only) return false if !@available || !@modified Builtins.y2milestone( "writing user %1 for autologin; pw_less is %2", @user, @pw_less ) SCR.Write( path(".sysconfig.displaymanager.DISPLAYMANAGER_AUTOLOGIN"), @user ) SCR.Write( path(".sysconfig.displaymanager.DISPLAYMANAGER_PASSWORD_LESS_LOGIN"), @pw_less ? "yes" : "no" ) SCR.Write(path(".sysconfig.displaymanager"), nil) @modified = false true end |