Author: dfiser
Date: Mon Jul 30 17:05:51 2007
New Revision: 39800
URL: http://svn.opensuse.org/viewcvs/yast?rev=39800&view=rev
Log:
Created system where is easy to define ACL groups and manipulate with them (new module SquidACL).
Testsuite repaired.
Added:
trunk/squid/src/SquidACL.ycp
trunk/squid/src/SquidACL_local_functions.ycp
Modified:
trunk/squid/src/Makefile.am
trunk/squid/src/Squid.ycp
trunk/squid/src/complex.ycp
trunk/squid/src/dialogs.ycp
trunk/squid/testsuite/tests/SquidRead.out
trunk/squid/testsuite/tests/SquidRead.ycp
Modified: trunk/squid/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/Makefile.am?rev=39800&r1=39799&r2=39800&view=diff
==============================================================================
--- trunk/squid/src/Makefile.am (original)
+++ trunk/squid/src/Makefile.am Mon Jul 30 17:05:51 2007
@@ -11,14 +11,16 @@
helps.ycp \
wizards.ycp \
dialogs.ycp \
- complex.ycp
+ complex.ycp \
+ SquidACL_local_functions.ycp
desktop_DATA = \
squid.desktop
module_DATA = \
Squid.ycp \
- Squid2.pm
+ Squid2.pm \
+ SquidACL.ycp
# create a symlink for local build, #145327
squid:
Modified: trunk/squid/src/Squid.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/Squid.ycp?rev=39800&r1=39799&r2=39800&view=diff
==============================================================================
--- trunk/squid/src/Squid.ycp (original)
+++ trunk/squid/src/Squid.ycp Mon Jul 30 17:05:51 2007
@@ -172,6 +172,18 @@
{
return acls;
}
+global map GetACL(integer id_item)
+{
+ return acls[id_item]:$[];
+}
+global void AddACL(map data)
+{
+ acls = add(acls, data);
+}
+global void ModifyACL(integer id_item, map value)
+{
+ acls[id_item] = value;
+}
/******* ACL END *******/
/******* HTTP_ACCESS ******/
@@ -179,6 +191,28 @@
{
return http_accesses;
}
+global map GetHttpAccess(integer id_item)
+{
+ return http_accesses[id_item]:$[];
+}
+global void AddHttpAccess(map value)
+{
+ http_accesses = add(http_accesses, value);
+}
+global void ModifyHttpAccess(integer id_item, map value)
+{
+ http_accesses[id_item] = value;
+}
+global void DelHttpAccess(integer id_item)
+{
+ http_accesses = remove(http_accesses, id_item);
+}
+global void MoveHttpAccess(integer id_from, integer id_to)
+{
+ map tmp = http_accesses[id_from]:$[];
+ http_accesses[id_from] = http_accesses[id_to]:$[];
+ http_accesses[id_to] = tmp;
+}
/******* HTTP_ACCESS END ******/
/******* SETTINGS *****/
Added: trunk/squid/src/SquidACL.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/SquidACL.ycp?rev=39800&view=auto
==============================================================================
--- trunk/squid/src/SquidACL.ycp (added)
+++ trunk/squid/src/SquidACL.ycp Mon Jul 30 17:05:51 2007
@@ -0,0 +1,155 @@
+/* ------------------------------------------------------------------------------
+ * Copyright (c) 2006 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may find
+ * current contact information at www.novell.com.
+ * ------------------------------------------------------------------------------
+ */
+
+/**
+ * File: include/squid/acl.ycp
+ * Package: Configuration of squid
+ * Summary: Definition and handling of ACL groups in Squid configuration
+ * Authors: Daniel Fiser
+ *
+ * $Id$
+ */
+
+{
+module "SquidACL";
+textdomain "squid";
+
+include "squid/SquidACL_local_functions.ycp";
+
+
+/**
+ * map of acl definition. format:
+ * $[
+ * "type" : $[ "name" : "Name shown in dialogs",
+ * "widget" : `WidgetDescribingThisType,
+ * "widget_init" : FunctionWithInitsOfWidget,
+ * "verification_func" : FunctionCalledToVerificateContentsOfWidget,
+ * "store_func" : FunctionCalledToStoreDataFromWidget //returns list of options
+ * ]
+ * ]
+ *
+ * widget_init prototype: void FuncName(integer id_item)
+ * verification_func prototype: boolean FuncName()
+ * store_func prototype: list<string> FuncName()
+ */
+map acl_map = $[
+ "src" : $[ "name" : "src",
+ "widget" : `Frame( _("src"),
+ `VBox(
+ `TextEntry(`id("acl_addr1"), _("IP Address 1"), ""),
+ //`Label(" - "),
+ `TextEntry(`id("acl_addr2"), _("IP Address 2"), ""),
+ //`Label("/"),
+ `TextEntry(`id("acl_mask"), _("Network Mask"), "")
+ )
+ ),
+ "widget_init" : srcWidgetInit,
+ "verification_func" : srcVerif,
+ "store_func" : srcStore ],
+
+ "dst" : $[ "name" : "dst",
+ "widget" : `Frame( _("dst"),
+ `VBox(
+ `TextEntry(`id("acl_addr"), _("IP Address"), ""),
+ `TextEntry(`id("acl_mask"), _("Network Mask"), "")
+ )
+ ),
+ "widget_init" : dstWidgetInit,
+ "verification_func" : dstVerif,
+ "store_func" : dstStore ],
+
+ "myip" : $[ "name" : "myip",
+ "widget" : `Frame( _("myip"),
+ `VBox(
+ `TextEntry(`id("acl_addr"), _("Local IP Address"), ""),
+ `TextEntry(`id("acl_mask"), _("Network Mask"), "")
+ )
+ ),
+ "widget_init" : myipWidgetInit,
+ "verification_func" : myipVerif,
+ "store_func" : myipStore ]
+];
+
+/**
+ * Specify order of acls.
+ * Values must corespond with keys in acl_map.
+ */
+list<string> acl_order = ["src", "dst", "myip"];
+
+
+
+/**
+ * Returns list of terms in form:
+ * [ `item(`id(key), acl_map[key]["name"]:""), `item(... ) ]
+ * Returned list is preferably to place in UI::ComboBox as list of
+ * all available types of ACLs.
+ */
+global list<term> GetTypesToComboBox()
+{
+ list<term> items = [];
+
+ foreach(string value, acl_order,
+ {
+ items = add(items, `item(`id(value), (acl_map[value]:$[])["name"]:""));
+ });
+
+ return items;
+}
+
+
+/**
+ * Initialize widget of acl identified by id_acl_type.
+ * If id_item is not nil, function initialize widgets by default values
+ * from module Squid.
+ */
+global void InitWidget(string id_acl_type, integer id_item)
+{
+ void(integer) func = (void(integer))(acl_map[id_acl_type]:$[])["widget_init"]:nil;
+ func(id_item);
+}
+
+/**
+ * Replace widget with id widget_id by widget acl_map[id_acl_type]["widget"].
+ */
+global void Replace(any widget_id, string id_acl_type)
+{
+ UI::ReplaceWidget(`id(widget_id), (acl_map[id_acl_type]:$[])["widget"]:`Empty());
+}
+
+
+/**
+ * This function call verification function joined with acl type
+ * identified by id_acl_type.
+ * Returns return value of verification function.
+ */
+global boolean Verify(string id_acl_type)
+{
+ boolean() func = (boolean())(acl_map[id_acl_type]:$[])["verification_func"]:nil;
+ return (boolean)func();
+}
+
+
+global list<string> Store(string id_acl_type)
+{
+ list<string>() func = (list<string>())(acl_map[id_acl_type]:$[])["store_func"]:nil;
+ return func();
+}
+}
+/* vim: set sw=4 ts=4 et ft=ycp : */
Added: trunk/squid/src/SquidACL_local_functions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/SquidACL_local_functions.ycp?rev=39800&view=auto
==============================================================================
--- trunk/squid/src/SquidACL_local_functions.ycp (added)
+++ trunk/squid/src/SquidACL_local_functions.ycp Mon Jul 30 17:05:51 2007
@@ -0,0 +1,178 @@
+/* ------------------------------------------------------------------------------
+ * Copyright (c) 2006 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may find
+ * current contact information at www.novell.com.
+ * ------------------------------------------------------------------------------
+ */
+
+/**
+ * File: include/squid/SquidACL_local_functions.ycp
+ * Package: Configuration of squid
+ * Summary: Non-global functions of SquidACL module which are linked with ACL_map variable.
+ * Authors: Daniel Fiser
+ *
+ * $Id$
+ */
+{
+
+textdomain "squid";
+import "Report";
+
+import "Squid";
+
+
+boolean isIPAddress(string str)
+{
+ return regexpmatch(str, "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+");
+}
+boolean isMask(string str)
+{
+ return regexpmatch(str, "[0-9]+") || isIPAddress(str);
+}
+
+
+
+void widgetInitIPAddr(any id)
+{
+ UI::ChangeWidget(`id(id), `ValidChars, "1234567890.");
+}
+void widgetInitMask(any id)
+{
+ UI::ChangeWidget(`id(id), `ValidChars, "1234567890.");
+}
+
+
+/****************** SRC *************************/
+void srcWidgetInit(integer id_item)//TODO:
+{
+ widgetInitIPAddr("acl_addr1");
+ widgetInitIPAddr("acl_addr2");
+ widgetInitMask("acl_mask");
+
+ if (id_item != nil){
+ map acl = Squid::GetACL(id_item);
+ list<string> tmp = [];
+ list<string> data = splitstring((acl["options"]:[])[0]:"", "/");
+ data[2] = data[1]:"";
+ tmp = splitstring(data[0]:"", "-");
+ if (size(tmp) == 1){
+ data[0] = "";
+ data[1] = tmp[0]:"";
+ }else{
+ data[0] = tmp[0]:"";
+ data[1] = tmp[1]:"";
+ }
+
+ y2debug("%1", data);
+ UI::ChangeWidget(`id("acl_addr1"), `Value, data[0]:"");
+ UI::ChangeWidget(`id("acl_addr2"), `Value, data[1]:"");
+ UI::ChangeWidget(`id("acl_mask"), `Value, data[2]:"");
+ }
+}
+
+boolean srcVerif(){
+ boolean ok = true;
+ string addr1 = (string)UI::QueryWidget(`id("acl_addr1"), `Value);
+ string addr2 = (string)UI::QueryWidget(`id("acl_addr2"), `Value);
+ string mask = (string)UI::QueryWidget(`id("acl_mask"), `Value);
+
+ if ((size(addr1) == 0 && size(addr2) == 0) ||
+ (size(addr1) > 0 && !isIPAddress(addr1)) ||
+ (size(addr2) > 0 && !isIPAddress(addr2)) ||
+ (size(mask) > 0 && !isMask(mask))){
+ ok = false;
+ Report::Error( _("Invalid values."));
+ }
+ return ok;
+}
+
+list<string> srcStore(){
+ list<string> data = [];
+ string addr1 = (string)UI::QueryWidget(`id("acl_addr1"), `Value);
+ string addr2 = (string)UI::QueryWidget(`id("acl_addr2"), `Value);
+ string mask = (string)UI::QueryWidget(`id("acl_mask"), `Value);
+
+ if (size(addr1) > 0 && size(addr2) > 0){
+ data[0] = addr1 + "-" + addr2;
+ }else{
+ data[0] = addr1 + addr2;
+ }
+ if (size(mask) > 0 && size(addr1)+size(addr2) > 0)
+ data[0] = data[0]:"" + "/" + mask;
+ return data;
+}
+/****************** SRC END *********************/
+
+
+/****************** DST *************************/
+void dstWidgetInit(integer id_item)
+{
+ widgetInitIPAddr("acl_addr");
+ widgetInitMask("acl_mask");
+
+ if (id_item != nil){
+ map acl = Squid::GetACL(id_item);
+ list<string> data = splitstring((acl["options"]:[])[0]:"", "/");
+
+ UI::ChangeWidget(`id("acl_addr"), `Value, data[0]:"");
+ UI::ChangeWidget(`id("acl_mask"), `Value, data[1]:"");
+ }
+}
+
+boolean dstVerif()
+{
+ boolean ok = true;
+ string addr = (string)UI::QueryWidget(`id("acl_addr"), `Value);
+ string mask = (string)UI::QueryWidget(`id("acl_mask"), `Value);
+
+ if (!isIPAddress(addr) || (size(mask) > 0 && !isMask(mask))){
+ ok = false;
+ Report::Error( _("Invalid values."));
+ }
+ return ok;
+}
+
+list<string> dstStore()
+{
+ list<string> data = [];
+ string addr = (string)UI::QueryWidget(`id("acl_addr"), `Value);
+ string mask = (string)UI::QueryWidget(`id("acl_mask"), `Value);
+
+ data[0] = addr;
+ if (size(mask) > 0 && size(addr) > 0)
+ data[0] = data[0]:"" + "/" + mask;
+ return data;
+}
+/****************** DST END *********************/
+
+
+/****************** MYIP ************************/
+void myipWidgetInit(integer id_item)
+{
+ widgetInitIPAddr("acl_addr");
+ widgetInitMask("acl_mask");
+}
+boolean myipVerif()
+{
+ return true;
+}
+list<string> myipStore()
+{
+ return [];
+}
+/****************** MYIP END ********************/
+}
+/* vim: set sw=4 ts=4 et ft=ycp : */
Modified: trunk/squid/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/complex.ycp?rev=39800&r1=39799&r2=39800&view=diff
==============================================================================
--- trunk/squid/src/complex.ycp (original)
+++ trunk/squid/src/complex.ycp Mon Jul 30 17:05:51 2007
@@ -39,6 +39,7 @@
import "Report";
import "Squid";
+import "SquidACL";
include "squid/helps.ycp";
@@ -253,6 +254,52 @@
UI::ChangeWidget(`id(`del_http_access), `Enabled, false);
}
}
+
+
+void InitAddEditHttpAccessDialog(integer id_item)
+{
+ list items = [];
+ list acls_items = [];
+
+ if (id_item != nil){
+ map http_access = Squid::GetHttpAccess(id_item);
+ integer i = 0;
+
+ foreach(string value, http_access["acl"]:[],
+ {
+ items = add(items, `item(`id(i), (search(value,"!")==0 ? "not" : ""), deletechars(value, "!")));
+ i = i+1;
+ });
+ UI::ChangeWidget(`id("acls"), `Items, items);
+ UI::ChangeWidget(`id("allow_deny"), `Value, (http_access["allow"]:true ? "allow" : "deny"));
+
+ items = [];
+ }
+
+ foreach(term value, (list<term>)UI::QueryWidget(`id("acls"), `Items),
+ {
+ acls_items = add(acls_items, value[2]:"");
+ });
+
+ foreach(map value, Squid::GetACLs(),
+ {
+ if (!contains(items, `item(`id(value["name"]:""), value["name"]:"")) &&
+ !contains(acls_items, value["name"]:""))
+ items = add(items, `item(`id(value["name"]:""), value["name"]:""));
+ });
+ UI::ChangeWidget(`id("acl"), `Items, items);
+ UI::ChangeWidget(`id("acl_not"), `Value, false);
+}
+
+
+void InitAddEditACLDialog(integer id_item)
+{
+ if (id_item != nil){
+ map acl = Squid::GetACL(id_item);
+ UI::ChangeWidget(`id("name"), `Value, acl["name"]:"");
+ UI::ChangeWidget(`id("type"), `Value, acl["type"]:"");
+ }
+}
/********************* INITS END ****************/
@@ -384,6 +431,92 @@
return ok;
}
+
+
+boolean StoreDataFromAddEditHttpAccessDialog(integer id_item)
+{
+ boolean ok = true;
+ boolean allow = true;
+ list<string> acls = [];
+ string tmp = "";
+
+ allow = (UI::QueryWidget(`id("allow_deny"), `Value) == "allow" ? true : false);
+ foreach(term value, (list<term>)UI::QueryWidget(`id("acls"), `Items),
+ {
+ tmp = (value[1]:"" == "not" ? "!" : "");
+ tmp = tmp + value[2]:"";
+ acls = add(acls, tmp);
+ });
+
+ if (size(acls) > 0){
+ if (id_item == nil){
+ Squid::AddHttpAccess($["allow" : allow, "acl" : acls]);
+ }else{
+ Squid::ModifyHttpAccess(id_item, $["allow" : allow, "acl" : acls]);
+ }
+ }else{
+ ok = false;
+ Report::Error(_("ACL table must not be empty."));
+ }
+
+ return ok;
+}
+void DelFromHttpAccessTable(integer id_item)
+{
+ Squid::DelHttpAccess(id_item);
+}
+integer MoveUpHttpAccess(integer id_item)
+{
+ integer ret = nil;
+
+ if (id_item > 0){
+ Squid::MoveHttpAccess(id_item, id_item - 1);
+ ret = id_item - 1;
+ }
+ return ret;
+}
+integer MoveDownHttpAccess(integer id_item)
+{
+ integer ret = nil;
+
+ if (id_item < size(Squid::GetHttpAccesses())-1){
+ Squid::MoveHttpAccess(id_item, id_item + 1);
+ ret = id_item + 1;
+ }
+ return ret;
+}
+
+
+boolean StoreDataFromAddEditACLDialog(integer id_item)
+{
+ boolean ok = true;
+ map data = $[];
+
+ string type = (string)UI::QueryWidget(`id("type"), `Value);
+ string name = (string)UI::QueryWidget(`id("name"), `Value);
+ boolean verification = SquidACL::Verify(type);
+
+ if (verification && size(name) > 0){
+ data["name"] = name;
+ data["type"] = type;
+ data["options"] = SquidACL::Store(type);
+
+ y2debug("complex::StoreDataFromAddEditACLDialog() - data: %1", data);
+
+ if (id_item == nil){
+ Squid::AddACL(data);
+ }else{
+ Squid::ModifyACL(id_item, data);
+ }
+ }else if(verification){ // -> size(name) <= 0
+ ok = false;
+ Report::Error( _("Name must not be empty."));
+ }else{
+ ok = false;
+ }
+
+ return ok;
+}
/********************* STORING + DELETING END ********************/
}
Modified: trunk/squid/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/dialogs.ycp?rev=39800&r1=39799&r2=39800&view=diff
==============================================================================
--- trunk/squid/src/dialogs.ycp (original)
+++ trunk/squid/src/dialogs.ycp Mon Jul 30 17:05:51 2007
@@ -33,6 +33,7 @@
import "Label";
import "Wizard";
+import "SquidACL";
//import "Squid";
@@ -53,7 +54,7 @@
term timeUnitWidget(string id)
{
return `ComboBox(`id(id), " ",
- [`item("seconds"), `item("minutes")]);
+ [`item("seconds"), `item("minutes"), `item("hours"), `item("days")]);
}
@@ -406,8 +407,155 @@
}
+
+void addItemToAddEditHttpAccessDialog(boolean not, string item)
+{
+ list items = [];
+
+ integer i = 0;
+ foreach (term value, (list<term>)UI::QueryWidget(`id("acls"), `Items),
+ {
+ items = add(items, `item(`id(i), value[1]:"", value[2]:""));
+ i = i+1;
+ });
+ items = add(items, `item(`id(i), (not == true ? "not" : ""), item));
+ UI::ChangeWidget(`id("acls"), `Items, items);
+}
+void delItemFromAddEditHttpAccessDialog(integer id_item)
+{
+ list items = [];
+
+ integer i = 0;
+ foreach (term value, (list<term>)UI::QueryWidget(`id("acls"), `Items),
+ {
+ if (value[0]:nil != `id(id_item)){
+ items = add(items, `item(`id(i), value[1]:"", value[2]:""));
+ i = i+1;
+ }
+ });
+ UI::ChangeWidget(`id("acls"), `Items, items);
+}
+boolean AddEditHttpAccessDialog(integer id_item)
+{
+ boolean ret = false;
+ any ui = nil;
+ string acl = "";
+ boolean not = false;
+ any tmp = nil;
+ term contents =
+ `VBox(
+ `ComboBox(`id("allow_deny"), _("Allow/Deny"),
+ [`item(`id("allow"), "allow"), `item(`id("deny"), "deny")]),
+
+ //`VSpacing(),
+
+ `MinSize(25, 7,
+ `Table(`id("acls"), `header(" ", _("ACL")), [])
+ ),
+ `Left(`PushButton(`id(`del), Label::DeleteButton())),
+
+ //`VSpacing(),
+
+ `Frame( _("Add ACL"),
+ `HBox(
+ `CheckBox(`id("acl_not"), _("not")),
+ `ComboBox(`id("acl"), "ACL", []),
+ `PushButton(`id(`add), Label::AddButton())
+ )
+ ),
+
+ `HBox(
+ `PushButton(`id(`cancel), Label::CancelButton()),
+ `PushButton(`id(`ok), Label::OKButton())
+ )
+ );
+
+ UI::OpenDialog(contents);
+
+ InitAddEditHttpAccessDialog(id_item);
+
+ while (true){
+ ui = UI::UserInput();
+
+ if (ui == `cancel || ui == `abort){
+ ret = false;
+ break;
+ }else if (ui == `ok){
+ if (StoreDataFromAddEditHttpAccessDialog(id_item)){
+ ret = true;
+ break;
+ }
+ }else if (ui == `add){
+ acl = (string)UI::QueryWidget(`id("acl"), `Value);
+ not = (boolean)UI::QueryWidget(`id("acl_not"), `Value);
+ if (size(acl) > 0){
+ addItemToAddEditHttpAccessDialog(not, acl);
+ InitAddEditHttpAccessDialog(nil);
+ }
+ }else if (ui == `del){
+ delItemFromAddEditHttpAccessDialog((integer)UI::QueryWidget(`id("acls"), `CurrentItem));
+ InitAddEditHttpAccessDialog(nil);
+ }
+ }
+
+
+ UI::CloseDialog();
+
+ return ret;
+}
+
+
+boolean AddEditACLDialog(integer id_item)
+{
+ boolean ret = false;
+ any ui = nil;
+ string type = "";
+ term contents =
+ `VBox(
+ `TextEntry(`id("name"), _("Name"), ""),
+ `ComboBox(`id("type"), `opt(`notify), _("Type"), SquidACL::GetTypesToComboBox()),
+ `ReplacePoint(`id(`replace_point), `Empty()),
+
+ `HBox(
+ `PushButton(`id(`cancel), Label::CancelButton()),
+ `PushButton(`id(`ok), Label::OKButton())
+ )
+ );
+
+ UI::OpenDialog(contents);
+
+ InitAddEditACLDialog(id_item);
+
+ type = (string)UI::QueryWidget(`id("type"), `Value);
+ SquidACL::Replace(`replace_point, type);
+ SquidACL::InitWidget(type, id_item);
+
+ while (true){
+ ui = UI::UserInput();
+
+ if (ui == `cancel || ui == `abort){
+ ret = false;
+ break;
+ }else if (ui == `ok){
+ if (StoreDataFromAddEditACLDialog(id_item)){
+ ret = true;
+ break;
+ }
+ }else if (ui == "type"){
+ type = (string)UI::QueryWidget(`id("type"), `Value);
+ SquidACL::Replace(`replace_point, type);
+ SquidACL::InitWidget(type, id_item);
+ }
+ }
+
+
+ UI::CloseDialog();
+
+ return ret;
+}
any AccessControlDialog(){
any ret = nil;
+ integer id_item = nil;
term dialog_contents =
`VBox(
`Left(`Label(_("ACL Groups"))),
@@ -432,7 +580,7 @@
`HBox(
`PushButton(`id(`add_http_access), Label::AddButton()),
`PushButton(`id(`del_http_access), Label::DeleteButton()),
- `PushButton(`id(`modify_http_access), Label::EditButton()),
+ `PushButton(`id(`edit_http_access), Label::EditButton()),
`HStretch()
)
);
@@ -453,6 +601,42 @@
//if (Popup::ReallyAbort(true)) break;
break;
continue;
+ }else if (ret == `add_acl){
+ if (AddEditACLDialog(nil)){
+ InitACLGroupsTable();
+ }
+ }else if (ret == `edit_acl){
+ id_item = (integer)UI::QueryWidget(`id("acl"), `CurrentItem);
+ if (AddEditACLDialog(id_item)){
+ InitACLGroupsTable();
+ UI::ChangeWidget(`id("acl"), `CurrentItem, id_item);
+ }
+
+ }else if (ret == `add_http_access){
+ if (AddEditHttpAccessDialog(nil)){
+ InitHttpAccessTable();
+ }
+ }else if (ret == `edit_http_access){
+ id_item = (integer)UI::QueryWidget(`id("http_access"), `CurrentItem);
+ if (AddEditHttpAccessDialog(id_item)){
+ InitHttpAccessTable();
+ UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item);
+ }
+ }else if (ret == `del_http_access){
+ DelFromHttpAccessTable((integer)UI::QueryWidget(`id("http_access"), `CurrentItem));
+ InitHttpAccessTable();
+ }else if (ret == `up_http_access){
+ id_item = MoveUpHttpAccess((integer)UI::QueryWidget(`id("http_access"), `CurrentItem));
+ if (id_item != nil){
+ InitHttpAccessTable();
+ UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item);
+ }
+ }else if (ret == `down_http_access){
+ id_item = MoveDownHttpAccess((integer)UI::QueryWidget(`id("http_access"), `CurrentItem));
+ if (id_item != nil){
+ InitHttpAccessTable();
+ UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item);
+ }
}
}
@@ -527,7 +711,7 @@
));
Wizard::SetContentsButtons("Squid - Miscellaneous Setting", dialog_contents, "help",
- Label::BackButton(), Label::NextButton());
+ Label::BackButton(), Label::FinishButton());
while (true){
ret = UI::UserInput();
Modified: trunk/squid/testsuite/tests/SquidRead.out
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/testsuite/tests/SquidRead.out?rev=39800&r1=39799&r2=39800&view=diff
==============================================================================
--- trunk/squid/testsuite/tests/SquidRead.out (original)
+++ trunk/squid/testsuite/tests/SquidRead.out Mon Jul 30 17:05:51 2007
@@ -24,26 +24,26 @@
Dump ------------------------------
Dump Squid::readRestSetting()
Read .squid."access_log" ["/var/log/squid/access.log"]
-Read .squid."cache_dir" ["ufs", "/var/cache/squid", "100", "16", "256"]
+Read .squid."cache_dir" ["ufs /var/cache/squid 100 16 256"]
Read .squid."cache_log" ["/var/log/squid/cache.log"]
-Read .squid."cache_mem" ["80", "MB"]
+Read .squid."cache_mem" ["80 MB"]
Read .squid."cache_mgr" ["webmaster"]
Read .squid."cache_replacement_policy" ["lru"]
Read .squid."cache_store_log" ["/var/log/squid/store.log"]
Read .squid."cache_swap_high" ["95"]
Read .squid."cache_swap_log" ["none"]
Read .squid."cache_swap_low" ["90"]
-Read .squid."client_lifetime" ["1", "day"]
-Read .squid."connect_timeout" ["2", "minutes"]
+Read .squid."client_lifetime" ["1 day"]
+Read .squid."connect_timeout" ["2 minutes"]
Read .squid."emulate_httpd_log" ["off"]
Read .squid."error_directory" ["/usr/share/squid/errors/English"]
Read .squid."ftp_passive" ["on"]
-Read .squid."maximum_object_size" ["4096", "KB"]
+Read .squid."maximum_object_size" ["4096 KB"]
Read .squid."memory_replacement_policy" ["heap GDSF"]
-Read .squid."minimum_object_size" ["0", "KB"]
+Read .squid."minimum_object_size" ["0 KB"]
Return true
Dump Squid::settings
-Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_log":["none"], "cache_swap_low":["90"], "client_lifetime":["1"], "connect_timeout":["2"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096"], "memory_replacement_policy":["heap", "GDSF"], "minimum_object_size":["0"]]
+Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs", "/var/cache/squid", "100", "16", "256"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80", "MB"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_log":["none"], "cache_swap_low":["90"], "client_lifetime":["1", "day"], "connect_timeout":["2", "minutes"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096", "KB"], "memory_replacement_policy":["heap GDSF"], "minimum_object_size":["0", "KB"]]
Dump ------------------------------
Dump Squid::Read()
Read .squid."http_port" ["localhost:3128", "80 transparent"]
@@ -51,26 +51,26 @@
Read .squid."acl" ["QUERY urlpath_regex cgi-bin \\?", "apache rep_header Server ^Apache", "all src 0.0.0.0/0.0.0.0", "manager proto cache_object", "localhost src \t \t 127.0.0.1/255.255.255.255", "localhost_public src 10.20.1.241/255.255.255.255", "to_localhost dst 127.0.0.0/8", "SSL_ports port 443", "Safe_ports port 80", "Safe_ports port 21", "Safe_ports port 443", "Safe_ports port 70", "Safe_ports port 210", "Safe_ports port 1025-65535", "Safe_ports port 280", "Safe_ports port 488", "Safe_ports port 591", "Safe_ports port 777", "CONNECT method CONNECT"]
Read .squid."http_access" ["allow manager localhost", "deny manager", "deny !Safe_ports", "deny CONNECT !SSL_ports", "allow localhost", "allow localhost_public", "deny all"]
Read .squid."access_log" ["/var/log/squid/access.log"]
-Read .squid."cache_dir" ["ufs", "/var/cache/squid", "100", "16", "256"]
+Read .squid."cache_dir" ["ufs /var/cache/squid 100 16 256"]
Read .squid."cache_log" ["/var/log/squid/cache.log"]
-Read .squid."cache_mem" ["80", "MB"]
+Read .squid."cache_mem" ["80 MB"]
Read .squid."cache_mgr" ["webmaster"]
Read .squid."cache_replacement_policy" ["lru"]
Read .squid."cache_store_log" ["/var/log/squid/store.log"]
Read .squid."cache_swap_high" ["95"]
Read .squid."cache_swap_log" ["none"]
Read .squid."cache_swap_low" ["90"]
-Read .squid."client_lifetime" ["1", "day"]
-Read .squid."connect_timeout" ["2", "minutes"]
+Read .squid."client_lifetime" ["1 day"]
+Read .squid."connect_timeout" ["2 minutes"]
Read .squid."emulate_httpd_log" ["off"]
Read .squid."error_directory" ["/usr/share/squid/errors/English"]
Read .squid."ftp_passive" ["on"]
-Read .squid."maximum_object_size" ["4096", "KB"]
+Read .squid."maximum_object_size" ["4096 KB"]
Read .squid."memory_replacement_policy" ["heap GDSF"]
-Read .squid."minimum_object_size" ["0", "KB"]
+Read .squid."minimum_object_size" ["0 KB"]
Return true
Dump Squid::settings
-Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_log":["none"], "cache_swap_low":["90"], "client_lifetime":["1"], "connect_timeout":["2"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096"], "memory_replacement_policy":["heap", "GDSF"], "minimum_object_size":["0"]]
+Return $["access_log":["/var/log/squid/access.log"], "cache_dir":["ufs", "/var/cache/squid", "100", "16", "256"], "cache_log":["/var/log/squid/cache.log"], "cache_mem":["80", "MB"], "cache_mgr":["webmaster"], "cache_replacement_policy":["lru"], "cache_store_log":["/var/log/squid/store.log"], "cache_swap_high":["95"], "cache_swap_log":["none"], "cache_swap_low":["90"], "client_lifetime":["1", "day"], "connect_timeout":["2", "minutes"], "emulate_httpd_log":["off"], "error_directory":["/usr/share/squid/errors/English"], "ftp_passive":["on"], "maximum_object_size":["4096", "KB"], "memory_replacement_policy":["heap GDSF"], "minimum_object_size":["0", "KB"]]
Dump Squid::acls
Return [$["name":"QUERY", "options":["cgi-bin", "\\?"], "type":"urlpath_regex"], $["name":"apache", "options":["Server", "^Apache"], "type":"rep_header"], $["name":"all", "options":["0.0.0.0/0.0.0.0"], "type":"src"], $["name":"manager", "options":["cache_object"], "type":"proto"], $["name":"localhost", "options":["127.0.0.1/255.255.255.255"], "type":"src"], $["name":"localhost_public", "options":["10.20.1.241/255.255.255.255"], "type":"src"], $["name":"to_localhost", "options":["127.0.0.0/8"], "type":"dst"], $["name":"SSL_ports", "options":["443"], "type":"port"], $["name":"Safe_ports", "options":["80"], "type":"port"], $["name":"Safe_ports", "options":["21"], "type":"port"], $["name":"Safe_ports", "options":["443"], "type":"port"], $["name":"Safe_ports", "options":["70"], "type":"port"], $["name":"Safe_ports", "options":["210"], "type":"port"], $["name":"Safe_ports", "options":["1025-65535"], "type":"port"], $["name":"Safe_ports", "options":["280"], "type":"port"], $["name":"Safe_ports", "options":["488"], "type":"port"], $["name":"Safe_ports", "options":["591"], "type":"port"], $["name":"Safe_ports", "options":["777"], "type":"port"], $["name":"CONNECT", "options":["CONNECT"], "type":"method"]]
Dump Squid::refresh_patterns
@@ -87,7 +87,7 @@
Read .squid."acl" ["QUERY urlpath_regex cgi-bin \\?", "apache rep_header Server ^Apache", "all src 0.0.0.0/0.0.0.0", "manager proto cache_object", "localhost src \t \t 127.0.0.1/255.255.255.255", "localhost_public src 10.20.1.241/255.255.255.255", "to_localhost dst 127.0.0.0/8", "SSL_ports port 443", "Safe_ports port 80", "Safe_ports port 21", "Safe_ports port 443", "Safe_ports port 70", "Safe_ports port 210", "Safe_ports port 1025-65535", "Safe_ports port 280", "Safe_ports port 488", "Safe_ports port 591", "Safe_ports port 777", "CONNECT method CONNECT"]
Read .squid."http_access" ["allow manager localhost", "deny manager", "deny !Safe_ports", "deny CONNECT !SSL_ports", "allow localhost", "allow localhost_public", "deny all"]
Read .squid."access_log" ["/var/log/squid/access.log"]
-Read .squid."cache_dir" ["ufs", "/var/cache/squid", "100", "16", "256"]
+Read .squid."cache_dir" ["ufs /var/cache/squid 100 16 256"]
Read .squid."cache_log" ["/var/log/squid/cache.log"]
Read .squid."cache_mem" nil
Read .squid."cache_mgr" ["webmaster"]
@@ -96,14 +96,14 @@
Read .squid."cache_swap_high" ["95"]
Read .squid."cache_swap_log" ["none"]
Read .squid."cache_swap_low" ["90"]
-Read .squid."client_lifetime" ["1", "day"]
-Read .squid."connect_timeout" ["2", "minutes"]
+Read .squid."client_lifetime" ["1 day"]
+Read .squid."connect_timeout" ["2 minutes"]
Read .squid."emulate_httpd_log" ["off"]
Read .squid."error_directory" ["/usr/share/squid/errors/English"]
Read .squid."ftp_passive" ["on"]
-Read .squid."maximum_object_size" ["4096", "KB"]
+Read .squid."maximum_object_size" ["4096 KB"]
Read .squid."memory_replacement_policy" nil
-Read .squid."minimum_object_size" ["0", "KB"]
+Read .squid."minimum_object_size" ["0 KB"]
Return true
Dump Squid::settings["cache_mem"]:["1"] == Squid::parameters["cache_mem"]:["2"]
Return true
Modified: trunk/squid/testsuite/tests/SquidRead.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/testsuite/tests/SquidRead.ycp?rev=39800&r1=39799&r2=39800&view=diff
==============================================================================
--- trunk/squid/testsuite/tests/SquidRead.ycp (original)
+++ trunk/squid/testsuite/tests/SquidRead.ycp Mon Jul 30 17:05:51 2007
@@ -35,12 +35,12 @@
"-i ^gopher:\t1440\t0%\t1440",
".\t\t0\t20%\t4320"],
- "cache_dir" : ["ufs", "/var/cache/squid", "100", "16", "256"],
- "cache_mem" : ["80", "MB"],
+ "cache_dir" : ["ufs /var/cache/squid 100 16 256"],
+ "cache_mem" : ["80 MB"],
"cache_swap_low" : ["90"],
"cache_swap_high" : ["95"],
- "maximum_object_size" : ["4096", "KB"],
- "minimum_object_size" : ["0", "KB"],
+ "maximum_object_size" : ["4096 KB"],
+ "minimum_object_size" : ["0 KB"],
"cache_replacement_policy" : ["lru"],
"memory_replacement_policy" : ["heap GDSF"],
@@ -50,8 +50,8 @@
"cache_swap_log" : ["none"],
"emulate_httpd_log" : ["off"],
- "connect_timeout" : ["2", "minutes"],
- "client_lifetime" : ["1", "day"],
+ "connect_timeout" : ["2 minutes"],
+ "client_lifetime" : ["1 day"],
"error_directory" : ["/usr/share/squid/errors/English"],
"cache_mgr" : ["webmaster"],
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org