Module: Yast::UsersRoutinesInclude
- Defined in:
- ../../src/include/users/routines.rb
Instance Method Summary (collapse)
-
- (Object) GetInt(value, default_value)
helper function: return the 'any' value as integer.
-
- (Object) GetString(value, default_value)
helper function: return the 'any' value as string.
- - (Object) initialize_users_routines(include_target)
-
- (Object) installation
check if this is installation stage - adding user during firstboot should be same as during 2nd stage.
-
- (String) SplitFullName(what, cn)
Split cn (fullname) in forename and surname.
-
- (Object) UserLogged(name)
if the user has log on system.
Instance Method Details
- (Object) GetInt(value, default_value)
helper function: return the 'any' value as integer
45 46 47 48 49 50 51 52 53 |
# File '../../src/include/users/routines.rb', line 45 def GetInt(value, default_value) value = deep_copy(value) return default_value if value == nil return Convert.to_integer(value) if Ops.is_integer?(value) if Ops.is_string?(value) && !value.empty? return value.to_i end default_value end |
- (Object) GetString(value, default_value)
helper function: return the 'any' value as string
56 57 58 59 60 |
# File '../../src/include/users/routines.rb', line 56 def GetString(value, default_value) value = deep_copy(value) return default_value if value == nil Builtins.sformat("%1", value) end |
- (Object) initialize_users_routines(include_target)
31 32 33 34 35 36 |
# File '../../src/include/users/routines.rb', line 31 def initialize_users_routines(include_target) Yast.import "Mode" Yast.import "Autologin" textdomain "users" end |
- (Object) installation
check if this is installation stage - adding user during firstboot should be same as during 2nd stage
40 41 42 |
# File '../../src/include/users/routines.rb', line 40 def installation Stage.cont || Stage.firstboot end |
- (String) SplitFullName(what, cn)
Split cn (fullname) in forename and surname.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File '../../src/include/users/routines.rb', line 68 def SplitFullName(what, cn) cn = "" if cn == nil # if cn is to be substituted, do not try to resolve givenName/sn return "" if Builtins.issubstring(cn, "%") strs = Builtins.splitstring(cn, " ") i = 1 sn = "" givenName = "" Builtins.foreach(strs) do |str| if Ops.less_than(i, Builtins.size(strs)) if givenName == "" givenName = str else givenName = Ops.add(Ops.add(givenName, " "), str) end else sn = str end i = Ops.add(i, 1) end return sn if what == :sn return givenName if what == :givenName nil end |
- (Object) UserLogged(name)
if the user has log on system
98 99 100 101 102 103 104 105 106 107 |
# File '../../src/include/users/routines.rb', line 98 def UserLogged(name) out = Convert.to_map( SCR.Execute( path(".target.bash_output"), Builtins.sformat("ps --no-headers -u %1", name) ) ) proc = Ops.get_string(out, "stdout", "") Builtins.size(proc) != 0 && !Mode.config end |