From 4dfa7e2a66ca897f4fd1a07b4da5cbc069f5592b Mon Sep 17 00:00:00 2001 From: Sergey Kalinin Date: Fri, 20 Jul 2018 06:50:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B8=20=D0=98=D0=91=20=D0=A0=D0=B5=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=86=D0=B5=D0=B4=D1=83=D1=80=D1=8B=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=8D=D0=BB=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B1=D0=B5=D0=B7=D0=BE=D0=BF=D0=B0=D1=81=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/function.tcl | 91 ++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/lib/function.tcl b/lib/function.tcl index 60148ab..b36aef1 100644 --- a/lib/function.tcl +++ b/lib/function.tcl @@ -658,25 +658,25 @@ proc Run::rule {tree host values} { } proc Run::directory {tree host values} { - Run::acl $tree $host $values directory + Run::acl $host $values directory } proc Run::com {tree host values} { - Run::acl $tree $host $values com + Run::acl $host $values com } proc Run::addin {tree host values} { - Run::acl $tree $host $values addin + Run::acl $host $values addin } proc Run::module {tree host values} { - Run::acl $tree $host $values module + Run::acl $host $values module } proc Run::app {tree host values} { - Run::acl $tree $host $values app + Run::acl $host $values app } proc Run::inet {tree host values} { - Run::acl $tree $host $values inet + Run::acl $host $values inet } -proc Run::acl {tree host values mode} { +proc Run::acl {host values mode} { global active_cluster cluster_user cluster_pwd profile_name if {$cluster_user ne "" && $cluster_pwd ne ""} { set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd" @@ -1028,7 +1028,7 @@ proc Add::infobases {tree host values} { --locale=[.add.frm.ent_locale get] \ --db-user=[.add.frm.ent_db_user get] \ --db-pwd=[.add.frm.ent_db_pwd get] \ - --descr=\"[.add.frm.ent_descr get]\" \ + --descr=[regsub -all -- " " [.add.frm.ent_descr get] "\\ "] \ --date-offset=$date_offset \ --security-level=$security_level \ --scheduled-jobs-deny=$scheduled_jobs_deny \ @@ -1264,7 +1264,7 @@ proc Add::profile {tree host values} { RunCommand "profile update \ --cluster=$active_cluster $auth \ --name=[.add.frm.ent_name get] \ - --descr=[.add.frm.ent_descr get] \ + --descr=[regsub -all -- " " [.add.frm.ent_descr get] "\\ "] \ --config=$config \ --priv=$priv \ --crypto=$crypto \ @@ -1317,12 +1317,12 @@ proc Add::directory {tree host values} { .add.frm_btn.btn_ok configure -command { - RunCommand "profile acl directory update \ - --cluster=$active_cluster $auth \ - --name=$profile_name \ - --alias=[.add.frm.ent_alias get] \ - --descr=[.add.frm.ent_descr get] \ - --physicalPath=[.add.frm.ent_descr get] \ + RunCommand "profile --cluster=$active_cluster $auth \ + acl --name=$profile_name \ + directory update \ + \"--alias=[regsub -all -- " " [.add.frm.ent_alias get] "\\ "]\" \ + \"--descr=[regsub -all -- " " [.add.frm.ent_descr get] "\\ "]\" \ + \"--physicalPath=[regsub -all -- " " [.add.frm.ent_physicalPath get] "\\ "]\" \ --allowedRead=$allowedRead \ --allowedWrite=$allowedWrite \ $host" @@ -1361,11 +1361,11 @@ proc Add::addin {tree host values} { grid $frm.ent_hash -row 2 -column 1 -sticky nw -padx 5 -pady 5 .add.frm_btn.btn_ok configure -command { - RunCommand "profile acl addin update \ - --cluster=$active_cluster $auth \ - --name=$profile_name \ - --name=[.add.frm.ent_name get] \ - --descr=[.add.frm.ent_descr get] \ + RunCommand "profile --cluster=$active_cluster $auth \ + acl --name=$profile_name \ + addin update \ + \"--name=[regsub -all -- " " [.add.frm.ent_name get] "\\ "]\" \ + \"--descr=[regsub -all -- " " [.add.frm.ent_descr get] "\\ "]\" \ --hash=[.add.frm.ent_hash get] \ $host" Run::addin $tree $host $profile_name @@ -1402,11 +1402,11 @@ proc Add::module {tree host values} { grid $frm.ent_hash -row 2 -column 1 -sticky nw -padx 5 -pady 5 .add.frm_btn.btn_ok configure -command { - RunCommand "profile acl module update \ - --cluster=$active_cluster $auth \ - --name=$profile_name \ - --name=[.add.frm.ent_name get] \ - --descr=[.add.frm.ent_descr get] \ + RunCommand "profile --cluster=$active_cluster $auth \ + acl --name=$profile_name \ + module update \ + \"--name=[regsub -all -- " " [.add.frm.ent_name get] "\\ "]\" \ + \"--descr=[regsub -all -- " " [.add.frm.ent_descr get] "\\ "]\" \ --hash=[.add.frm.ent_hash get] \ $host" Run::module $tree $host $profile_name @@ -1452,12 +1452,11 @@ proc Add::com {tree host values} { .add.frm_btn.btn_ok configure -command { - RunCommand "profile acl com update \ - --cluster=$active_cluster $auth \ - --name=$profile_name \ - --name=[.add.frm.ent_name get] \ - --descr=[.add.frm.ent_descr get] \ - --fileName=[.add.frm.ent_fileName get] \ + RunCommand "profile --cluster=$active_cluster $auth \ + acl --name=$profile_name com update \ + \"--name=[regsub -all -- " " [.add.frm.ent_name get] "\\ "]\" \ + \"--descr=[regsub -all -- " " [.add.frm.ent_descr get] "\\ "]\" \ + \"--fileName=[regsub -all -- " " [.add.frm.ent_fileName get] "\\ "]\" \ --id=[.add.frm.ent_id get] \ --host=[.add.frm.ent_host get] \ $host" @@ -1495,12 +1494,11 @@ proc Add::app {tree host values} { grid $frm.ent_wild -row 2 -column 1 -sticky nw -padx 5 -pady 5 .add.frm_btn.btn_ok configure -command { - RunCommand "profile acl app update \ - --cluster=$active_cluster $auth \ - --name=$profile_name \ - --name=[.add.frm.ent_name get] \ - --descr=[.add.frm.ent_descr get] \ - --wild=[.add.frm.ent_wild get] \ + RunCommand "profile --cluster=$active_cluster $auth \ + acl --name=$profile_name app update \ + \"--name=[regsub -all -- " " [.add.frm.ent_name get] "\\ "]\" \ + \"--descr=[regsub -all -- " " [.add.frm.ent_descr get] "\\ "]\" \ + \"--wild=[regsub -all -- " " [.add.frm.ent_wild get] "\\ "]\" \ $host" Run::app $tree $host $profile_name destroy .add @@ -1528,7 +1526,7 @@ proc Add::inet {tree host values} { label $frm.lbl_protocol -justify left -anchor nw -text "Протокол" entry $frm.ent_protocol label $frm.lbl_url -justify left -anchor nw -text "Адрес (URL)" - entry $frm.url + entry $frm.ent_url label $frm.lbl_port -justify left -anchor nw -text "Порт" entry $frm.ent_port $frm.ent_port insert end 0 @@ -1546,13 +1544,12 @@ proc Add::inet {tree host values} { .add.frm_btn.btn_ok configure -command { - RunCommand "profile acl inet update \ - --cluster=$active_cluster $auth \ - --name=$profile_name \ - --name=[.add.frm.ent_name get] \ - --descr=[.add.frm.ent_descr get] \ + RunCommand "profile --cluster=$active_cluster $auth \ + acl --name=$profile_name inet update \ + \"--name=[regsub -all -- " " [.add.frm.ent_name get] "\\ "]\" \ + \"--descr=[regsub -all -- " " [.add.frm.ent_descr get] "\\ "]\" \ --protocol=[.add.frm.ent_protocol get] \ - --url=[.add.frm.ent_url get] \ + \"--url=[regsub -all -- " " [.add.frm.ent_url get] "\\ "]\" \ --port=[.add.frm.ent_port get] \ $host" Run::inet $tree $host $profile_name @@ -1892,7 +1889,7 @@ proc Edit::profile {tree host values} { RunCommand "profile update \ --cluster=$active_cluster $auth \ --name=[.add.frm.ent_name get] \ - --descr=[.add.frm.ent_descr get] \ + \"--descr=[regsub -all -- " " [.add.frm.ent_descr get] "\\ "]\" \ --config=$config \ --priv=$priv \ --crypto=$crypto \ @@ -1909,6 +1906,7 @@ proc Edit::profile {tree host values} { proc Edit::profiles {tree host values} { return } + proc Del {} { global active_cluster host set tree .frm_tree.tree @@ -2196,7 +2194,7 @@ proc Del::acl {host type name profile_name} { -icon question -type yesno ] switch -- $answer { yes { - set lst [RunCommand "profile acl $type remove $item --cluster=$active_cluster --name=$profile_name $auth $host"] + set lst [RunCommand "profile --cluster=$active_cluster acl --name=$profile_name $type remove $item $auth $host"] #.frm_tree.tree delete "profile::$values" .frm_work.tree_work delete [ .frm_work.tree_work children {}] Run::$type .frm_tree.tree $host $active_cluster @@ -2226,3 +2224,4 @@ proc Del::inet {tree host profile_name} { +