From 1a1c39f95191e6ca7d3c52df54f4d7e684c7411c Mon Sep 17 00:00:00 2001 From: Sergey Kalinin Date: Tue, 3 Jul 2018 12:55:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B2=D0=BE=D0=B4=20=D1=8D=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=B1=D0=B5=D0=B7=D0=BE=D0=BF=D0=B0=D1=81=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B8.=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=B2=D0=B8=D1=80=D1=82=D1=83=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/function.tcl | 90 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/lib/function.tcl b/lib/function.tcl index 7ba29e5..a5a1fe4 100644 --- a/lib/function.tcl +++ b/lib/function.tcl @@ -25,7 +25,7 @@ proc TreePress {tree} { } proc SetGlobalVarFromTreeItems {tree id} { - global host server active_cluster infobase + global host server active_cluster infobase profile_name set parent [$tree parent $id] set values [$tree item $id -values] set key [lindex [split $id "::"] 0] @@ -34,6 +34,7 @@ proc SetGlobalVarFromTreeItems {tree id} { work_server {set server $values} cluster {set active_cluster $values} infobase {set infobase $values} + profile {set profile_name $values} } if {$parent eq ""} { return @@ -206,7 +207,7 @@ proc InsertWorkServerItems {tree id} { proc InsertProfileItems {tree id} { set parent "profile::$id" set lst { - {dir "Виртуальные каталоги"} + {directory "Виртуальные каталоги"} {com "Разрешённые COM-классы"} {addin "Внешние компоненты"} {module "Внешние отчёты и обработки"} @@ -656,6 +657,41 @@ proc Run::rule {tree host values} { } } +proc Run::directory {tree host values} { + Run::acl $tree $host $values directory +} +proc Run::com {tree host values} { + Run::acl $tree $host $values com +} +proc Run::addin {tree host values} { + Run::acl $tree $host $values addin +} +proc Run::module {tree host values} { + Run::acl $tree $host $values module +} +proc Run::app {tree host values} { + Run::acl $tree $host $values app +} +proc Run::inet {tree host values} { + Run::acl $tree $host $values inet +} + +proc Run::acl {tree 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" + } else { + set auth "" + } + .frm_work.tree_work delete [ .frm_work.tree_work children {}] + set lst [RunCommand "profile acl $mode list --cluster=$active_cluster --name=$profile_name $auth $host"] + + foreach l $lst { + #puts $l + InsertItemsWorkList $l + } +} + proc Add {} { global active_cluster host set id [.frm_tree.tree selection] @@ -1829,6 +1865,7 @@ proc Del::server {tree host values} { no {return} } } + proc Del::profile {tree host values} { global active_cluster agent_user agent_pwd cluster_user cluster_pwd auth if {$cluster_user ne "" && $cluster_pwd ne ""} { @@ -1858,4 +1895,51 @@ proc Del::profiles {tree host values} { } - +proc Del::acl {host type name profile_name} { + global active_cluster agent_user agent_pwd cluster_user cluster_pwd auth + if {$cluster_user ne "" && $cluster_pwd ne ""} { + set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd" + } else { + set auth "" + } + if {$agent_user ne "" && $agent_pwd ne ""} { + set agent_auth "--agent-user=$agent_user --agent-pwd=$agent_pwd" + } else { + set agent_auth "" + } + if {$type eq "directory"} { + set item "--alias=$name" + } else { + set item "--name=$name" + } + set answer [tk_messageBox -message "Удалить $type - $name?" \ + -icon question -type yesno ] + switch -- $answer { + yes { + set lst [RunCommand "profile acl $type remove $item --cluster=$active_cluster --name=$profile_name $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 + } + no {return} + } +} +proc Del::directory {tree host profile_name} { + puts "$tree $host [GetWorkTreeItems "alias"] $profile_name" + Del::acl $host directory [GetWorkTreeItems "alias"] $profile_name +} +proc Del::com {tree host profile_name} { + Del::acl $host com [GetWorkTreeItems "name"] $profile_name +} +proc Del::addin {tree host profile_name} { + Del::acl $host addin [GetWorkTreeItems "name"] $profile_name +} +proc Del::module {tree host profile_name} { + Del::acl $host module [GetWorkTreeItems "name"] $profile_name +} +proc Del::app {tree host profile_name} { + Del::acl $host app [GetWorkTreeItems "name"] $profile_name +} +proc Del::inet {tree host profile_name} { + Del::acl $host inet [GetWorkTreeItems "name"] $profile_name +}