Добавлены процедуры редактирования и удаления профиля безопасности

This commit is contained in:
Sergey Kalinin 2018-06-25 10:25:17 +03:00
parent 234ad208fb
commit 4195f8e375

View File

@ -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"]
}