home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)editroleri.tcl 1.13
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)editroleri.tcl 1.13 26 Mar 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require "rolerights.tcl"
-
- Class EditRoleRightsDlg : {RoleRightsDlg} {
- constructor
- method destructor
- method ok
- method popUp
- attribute errorStack
- }
-
- constructor EditRoleRightsDlg {class this name} {
- set this [RoleRightsDlg::constructor $class $this $name]
- # Start constructor user section
-
- 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
- }
-
- # 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} {
- $this createObjectsIf
- $this createRolesIf
- $this createActionsIf
- $this createRoleRightTypeIf
- $this createApplyIf
- $this selectedObjectSetChanged
- $this TemplateDialog::popUp
- if {"[$this errorStack]" != ""} {
- wmtkwarning [$this errorStack]
- $this errorStack ""
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
-