From 4195f8e3758e2370a8b4f96bb71c3f2d3ad3f48c Mon Sep 17 00:00:00 2001 From: Sergey Kalinin Date: Mon, 25 Jun 2018 10:25:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D0=B4=D1=83=D1=80?= =?UTF-8?q?=D1=8B=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B8=20=D1=83=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=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 | 88 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 2 deletions(-) diff --git a/lib/function.tcl b/lib/function.tcl index 11a3b77..4f18e48 100644 --- a/lib/function.tcl +++ b/lib/function.tcl @@ -1235,7 +1235,7 @@ proc Add::profile {tree host values} { --modules-available-for-extension=$modules_available_for_extension \ --modules-not-available-for-extension=$modules_not_available_for_extension \ $host" - Run::profiles $tree $host $server + Run::profiles $tree $host $active_cluster destroy .add } return $frm @@ -1532,7 +1532,63 @@ proc Edit::rule {tree host values} { destroy .add } } - +proc Edit::profile {tree host values} { + global default active_cluster server agent_user agent_pwd cluster_user cluster_pwd auth + global config priv crypto right_extension right_extension_definition_roles \ + all_modules_extension modules_available_for_extension modules_not_available_for_extension + if {$cluster_user ne "" && $cluster_pwd ne ""} { + set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd" + } else { + set auth "" + } + if {$cluster_user ne "" && $cluster_pwd ne ""} { + set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd" + } else { + set auth "" + } + + set frm [Add::profile $tree $host $values] + + $frm configure -text "Редактирование профиля безопасности: $values" + + set work_tree_id [.frm_work.tree_work selection] + puts "$work_tree_id" + set work_tree_values_list [.frm_work.tree_work item $work_tree_id -values] + set column_list [.frm_work.tree_work cget -columns] + set l1 [llength $column_list] + set l2 [llength $work_tree_values_list] + if {$l1 == $l2} { + for {set i 0} {$i <= $l1 } {incr i} { + lappend lst "[lindex $column_list $i] : [lindex $work_tree_values_list $i]" + } + } else { + return + } + FormFieldsDataInsert $frm [list $lst] + + .add.frm.ent_name configure -state disable + + .add.frm_btn.btn_ok configure -command { + RunCommand "profile update \ + --cluster=$active_cluster $auth \ + --name=[.add.frm.ent_name get] \ + --descr=[.add.frm.ent_descr get] \ + --config=$config \ + --priv=$priv \ + --crypto=$crypto \ + --right-extension=$right_extension \ + --right-extension-definition-roles=$right_extension_definition_roles \ + --all-modules-extension=$all_modules_extension \ + --modules-available-for-extension=$modules_available_for_extension \ + --modules-not-available-for-extension=$modules_not_available_for_extension \ + $host" + Run::profiles $tree $host $active_cluster + destroy .add + } +} +proc Edit::profiles {tree host values} { + return +} proc Del {} { global active_cluster host set tree .frm_tree.tree @@ -1770,4 +1826,32 @@ 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 ""} { + 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 "" + } + set answer [tk_messageBox -message "Удалить профиль безопасности $values?" \ + -icon question -type yesno ] + switch -- $answer { + yes { + set lst [RunCommand "profile remove --name=$values --cluster=$active_cluster $auth $host"] + .frm_tree.tree delete "profile::$values" + .frm_work.tree_work delete [ .frm_work.tree_work children {}] + Run::profiles $tree $host $active_cluster + } + no {return} + } +} +proc Del::profiles {tree host values} { + Del::profile $tree $host [GetWorkTreeItems "name"] +} +