home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
editroleri.tcl
< prev
next >
Wrap
Text File
|
1997-09-16
|
4KB
|
146 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)editroleri.tcl /main/titanic/5
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)editroleri.tcl /main/titanic/5 16 Sep 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require_module_file "rolerights.tcl" security
Class EditRoleRightsDlg : {RoleRightsDlg} {
constructor
method destructor
method ok
method popUp
method init
}
constructor EditRoleRightsDlg {class this name} {
set this [RoleRightsDlg::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method EditRoleRightsDlg::destructor {this} {
# Start destructor user section
[$this selectedSet] foreach obj {
$obj Controlled::quit
}
# End destructor user section
$this RoleRightsDlg::destructor
}
method EditRoleRightsDlg::ok {this} {
set script ""
foreach type [$this.top.row.leftCol.ruleType.row.type entrySet] {
global $this$type
if {! [info exists $this$type]} continue
set role ""
set index ""
set ${this}${type}(last,,) 0
foreach triple [lsort [array names $this$type]] {
set first [string first "," $triple]
set last [string last "," $triple]
set newIndex [string range $triple 0 [expr $first -1]]
set newRole [string range $triple [expr $first +1] [expr $last -1]]
set action [string range $triple [expr $last +1] end]
set access [set ${this}${type}($triple)]
unset ${this}${type}($triple)
if {"$index" != "$newIndex" || "$role" != "$newRole"} {
if {"$index" != ""} {
set obj [[$this selectedSet] index $index]
if {"$script" != ""} {
append script " ;"
}
case "$type" in {
childRight {
append script " $obj modifyNewChildRights \
$role $allowedMap $prohibitedMap $undefinedMap"
}
default {
append script " $obj modifyPermission \
$role $allowedMap $prohibitedMap $undefinedMap"
}
}
}
set allowedMap 0
set prohibitedMap 0
set undefinedMap 0
}
if {"$newIndex" == "last"} break
set index $newIndex
set role $newRole
set actionMap [BrowserProcs::string2Action $action]
case "$access" in {
Allowed {
set allowedMap [expr $allowedMap | $actionMap]
}
Prohibited {
set prohibitedMap [expr $prohibitedMap | $actionMap]
}
Undefined {
set undefinedMap [expr $undefinedMap | $actionMap]
}
}
}
}
if {"$script" != ""} {
$wmttoolObj startCommand tcl "$script" "wmtkmessage {}" \
"Saving role rights" {0 0} 1
}
$this AccessControlDlg::ok
}
method EditRoleRightsDlg::popUp {this} {
if {! [[$this selectedSet] empty]} {
$this createObjectsIf
$this createRolesIf
$this createActionsIf
$this createRoleRightTypeIf
$this createApplyIf
$this selectedObjectSetChanged
$this TemplateDialog::popUp
}
if {"[$this errorStack]" != ""} {
wmtkinfo [$this errorStack]
$this errorStack ""
}
}
method EditRoleRightsDlg::init {this} {
set errorStack ""
set nonEditableList ""
$this editable 1
[$this selectedSet] foreach obj {
if [catch {$obj Controlled::edit} msg] {
lappend nonEditableList $obj
if {"$errorStack" != ""} {
append errorStack "\n"
}
append errorStack $msg
}
}
$this errorStack $errorStack
foreach nonEditable $nonEditableList {
$this removeSelected $nonEditable
}
}
# Do not delete this line -- regeneration end marker