YaST2 Developers Documentation: Common widget manipulation, firewall interfaces widget

Common widget manipulation, firewall interfaces widget

modules/CWMFirewallInterfaces.ycp
Routines for selecting interfaces opened in firewall
  • Jiri Srain

This module has an unstable interface.

WARNING: If you want to use this functionality of this module you should allways call 'SuSEFirewall::Read()' in the Read() function of you module and you should call 'SuSEFirewall::Write()' in the Write() function. Functionality of this module only changes the SuSEFirewall settings in memory, it never Reads or Writes the settings. Additionally you may need to call Progress::set(false) before SuSEFirewall::Read() or SuSEFirewall::Write().

Imports

  • CWM
  • Label
  • Mode
  • NetworkInterfaces
  • Popup
  • Report
  • Stage
  • SuSEFirewall
  • SuSEFirewallProposal

Global Functions

Local Variables

Local Functions

local all_interfaces -> list<string>

List of all interfaces relevant for firewall settings

local interface_items -> list

List of all items of interfaces to the selection box

local allowed_interfaces -> list<string>

List of interfaces that are allowed

local configuration_changed -> boolean

Information if configuration was changed by user

local any_iface_supported -> boolean

`Any`-feature is supported in the firewall configuration

local EnableOrDisableFirewallDetails () -> void

Enable or disable the firewall details widget according to the status of "open firewall" checkbox

local SetFirewallLabel (symbol status) -> void

Set the firewall status label

Parameters:
status symbol one of `off, `closed, `open_all, `custom, `not_installed
local InitAllInterfacesList () -> void

Initialize the list of all known interfaces

local UpdateFirewallStatus () -> void

Update the firewall status label according to the current status

local Selected2Opened (list<string> ifaces, boolean nm_ifaces_have_to_be_selected) -> list<string>

Get the list of all interfaces that will be selected

Parameters:
ifaces a list of interfaces selected by the user
nm_ifaces_have_to_be_selected defines whether also NetworkManager have to be selected too
Return value:
a list of interfaces that will be opened
local DisplayFirewallDetailsPopupHandler (map<string,any> widget) -> void

Display popup with firewall settings details

Parameters:
widget
global InitAllowedInterfaces (list<string> services) -> void

Initialize the list of allowed interfaces Changes the internal variables

Parameters:
services a list of services
global StoreAllowedInterfaces (list<string> services) -> void

Store the list of allowed interfaces Users the internal variables

Parameters:
services a list of services
global InterfacesInit (map<string,any> widget, string key) -> void

Init function of the widget

Parameters:
widget
key strnig the widget key
global InterfacesHandle (map<string,any> widget, string key, map event) -> symbol

Handle function of the widget

Parameters:
widget
key strnig the widget key
event map event to be handled
Return value:
for wizard sequencer or nil
global InterfacesStore (map<string,any> widget, string key, map event) -> void

Store function of the widget

Parameters:
widget
key strnig the widget key
event map that caused widget data storing
global InterfacesValidate (map<string,any> widget, string key, map event) -> boolean

Validate function of the widget

Parameters:
widget
key strnig the widget key
event map event that caused the validation
Return value:
true if validation succeeded, false otherwise
local CheckPossbilityToChangeFirewall (boolean new_status) -> boolean

Checks whether it is possible to change the firewall status

Parameters:
new_status
global InterfacesInitWrapper (string key) -> void

Init function of the widget

Parameters:
key strnig the widget key
global InterfacesHandleWrapper (string key, map event) -> symbol

Handle function of the widget

Parameters:
key strnig the widget key
event map event to be handled
Return value:
for wizard sequencer or nil
global InterfacesStoreWrapper (string key, map event) -> void

Store function of the widget

Parameters:
key strnig the widget key
event map that caused widget data storing
global InterfacesValidateWrapper (string key, map event) -> boolean

Validate function of the widget

Parameters:
key strnig the widget key
event map event that caused the validation
Return value:
true if validation succeeded, false otherwise
global CreateInterfacesWidget (map<string,any> settings) -> map<string,any>

Get the widget description map

Parameters:
settings a map of all parameters needed to create the widget properly

 Behavior manipulating functions (mandatory)
 - "get_allowed_interfaces" : list() -- function that returns
          the list of allowed network interfaces
 - "set_allowed_interfaces" : void (list) -- function that sets
          the list of allowed interfaces

 Additional settings:
 - "help" : string -- help to the whole widget. If not specified, generic help
          is used (button labels are patched correctly)
 
Return value:
the widget description map
global DisplayDetailsPopup (map<string,any> settings) -> symbol

Display the firewall interfaces selection as a popup

Parameters:
settings
Return value:
return value of the dialog
global OpenFirewallInit (map<string,any> widget, string key) -> void

Initialize the open firewall widget

Parameters:
widget a map describing the whole widget
key
global OpenFirewallStore (map<string,any> widget, string key, map event) -> void

Store function of the widget

Parameters:
widget
key strnig the widget key
event map that caused widget data storing
global OpenFirewallHandle (map<string,any> widget, string key, map event) -> symbol

Handle the immediate start and stop of the service

Parameters:
widget a map describing the widget
key strnig the widget key
event
Return value:
always nil
global OpenFirewallInitWrapper (string key) -> void

Init function of the widget

Parameters:
key strnig the widget key
global OpenFirewallStoreWrapper (string key, map event) -> void

Store function of the widget

Parameters:
key strnig the widget key
event map that caused widget data storing
global OpenFirewallHandleWrapper (string key, map event) -> symbol

Handle the immediate start and stop of the service

Parameters:
key strnig the widget key
event
Return value:
always nil
global OpenFirewallModified (string key) -> boolean

Check if the widget was modified

Parameters:
key strnig the widget key
Return value:
true if widget was modified
global EnableOpenFirewallWidget () -> void

Enable the whole firewal widget

global DisableOpenFirewallWidget () -> void

Disable the whole firewal widget

global OpenFirewallWidgetExists () -> boolean

Check whether the whole firewall widget ( open port checkbox and fw details button) exists

Return value:
true if both widgets exist
global OpenFirewallHelpTemplate (boolean restart_displayed) -> string

Get the template for the help text to the firewall opening widget

Parameters:
restart_displayed shold be true if "Save and restart" is displayed
Return value:
help text template with %1 and %2 placeholders
global OpenFirewallHelp (boolean restart_displayed) -> string

Get the help text to the firewall opening widget

Parameters:
restart_displayed shold be true if "Save and restart" is displayed
Return value:
help text
global CreateOpenFirewallWidget (map<string,any> settings) -> map<string,any>

Get the widget description map of the firewall enablement widget

Parameters:
settings a map of all parameters needed to create the widget properly

 - "services" : list -- services identifications for the Firewall.ycp
          module
 - "display_details" : boolean -- true if the details button should be
          displayed
 - "firewall_details_handler" : symbol () -- function to handle the firewall
          details button. If returns something else than nil, dialog is
          exited with the returned symbol as value for wizard sequencer.
          If not specified, but "display_details" is true, common popup
          is used.
 - "open_firewall_checkbox" : string -- label of the check box
 - "firewall_details_button" : string -- label of the push button for
          changing firewall details
 - "help" : string -- help to the widget. If not specified, generic help
          is used
 
Return value:
the widget description map
global Modified () -> boolean

Check if settings were modified by the user

Return value:
true if settings were modified