Module: Yast::SecurityComplexInclude
- Defined in:
- ../../src/include/security/complex.rb
Instance Method Summary (collapse)
- - (Object) initialize_security_complex(include_target)
-
- (Object) MainDialog
Main dialog.
-
- (Object) WriteDialog
Write settings dialog.
Instance Method Details
- (Object) initialize_security_complex(include_target)
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File '../../src/include/security/complex.rb', line 30 def initialize_security_complex(include_target) Yast.import "UI" textdomain "security" Yast.import "Label" Yast.import "Security" Yast.import "Wizard" Yast.include include_target, "security/helps.rb" Yast.include include_target, "security/levels.rb" Yast.include include_target, "security/routines.rb" Yast.include include_target, "security/dialogs.rb" end |
- (Object) MainDialog
Main dialog
56 57 58 59 60 61 62 63 64 65 66 67 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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File '../../src/include/security/complex.rb', line 56 def MainDialog # Main dialog caption caption = _("Local Security Configuration") help = Ops.get_string(@HELPS, "main", "") settings = deep_copy(Security.Settings) Builtins.foreach(Security.do_not_test) do |key| settings = Builtins.remove(settings, key) end # Determine current settings current = :custom Builtins.maplist(@Levels) do |key, level| Builtins.y2debug("%1=%2", key, level) current = key if level == settings end Builtins.y2debug("%1=%2", current, Security.Settings) # Create RB group from the list of settings _RB = VBox() _RB = Builtins.add(_RB, VSpacing(0.5)) Builtins.mapmap(@LevelsLabels) do |key, name| _RB = Builtins.add( _RB, Left(RadioButton(Id(key), Opt(:notify), name, key == current)) ) _RB = Builtins.add(_RB, VSpacing(0.03)) { 0 => 0 } end _RB = Builtins.add(_RB, VSpacing(0.6)) # RadioButton label _RB = Builtins.add( _RB, Left( RadioButton( Id(:custom), Opt(:notify), _("&Custom Settings"), current == :custom ) ) ) _RB = Builtins.add(_RB, VSpacing(0.5)) Builtins.y2debug("RB=%1", _RB) # Main dialog contents contents = HVCenter( VBox( HVSquash( # Frame caption Frame( _("Security Settings"), HBox(HSpacing(0.8), RadioButtonGroup(Id(:rb), _RB), HSpacing(0.8)) ) ), VSpacing(0.6) ) ) contents = HVCenter( HVSquash( HBox( HSpacing(5), VBox(VSpacing(2), ReplacePoint(Id(:rp_main), contents), VSpacing(2)), HSpacing(5) ) ) ) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) ret = nil while true cur = UI.QueryWidget(Id(:rb), :CurrentButton) ret = UI.UserInput # abort? if ret == :abort || ret == :cancel if ReallyAbort() break else next end elsif ret == :back break elsif ret == :next # check_* break elsif ret == :custom next elsif Ops.is_string?(ret) || ret == :wizardTree if Builtins.contains(@tree_dialogs, ret) # the current item has been selected, do not change to the same dialog if ret == "main" # preselect the item if it has been unselected Wizard.SelectTreeItem("main") if Wizard.QueryTreeItem != "main" next end # switch to another dialog break end if !Builtins.haskey(@Levels, Convert.to_string(ret)) Builtins.y2error("Unexpected return code (key missing): %1", ret) next end next else Builtins.y2error("Unexpected return code: %1", ret) next end end if ret == :next || Builtins.contains(@tree_dialogs, ret) cur = UI.QueryWidget(Id(:rb), :CurrentButton) Builtins.y2debug("current=%1", current) Builtins.y2debug("cur=%1", cur) if cur != :custom if current != cur Builtins.y2debug("Level modified (%1)", cur) Security.Settings = Ops.get(@Levels, Convert.to_string(cur), {}) Security.modified = true end ret = :finish if ret == :next end end deep_copy(ret) end |
- (Object) WriteDialog
Write settings dialog
47 48 49 50 51 52 |
# File '../../src/include/security/complex.rb', line 47 def WriteDialog Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", "")) Security.AbortFunction = lambda { Security.PollAbort } ret = Security.Write ret ? :next : :abort end |