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 +}