home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / roledbobj.tcl < prev    next >
Text File  |  1996-10-08  |  3KB  |  125 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)roledbobj.tcl    /main/hindenburg/1
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)roledbobj.tcl    /main/hindenburg/1   8 Oct 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. require "userroleob.tcl"
  15.  
  16. Class RoleDbObj : {UserRoleObj Role} {
  17.     method destructor
  18.     constructor
  19.     method addUserRoleLinks
  20.     method userLinks
  21. }
  22.  
  23. method RoleDbObj::destructor {this} {
  24.     # Start destructor user section
  25.     # End destructor user section
  26.     $this UserRoleObj::destructor
  27. }
  28.  
  29. constructor RoleDbObj {class this name} {
  30.     set this [Role::constructor $class $this $name]
  31.     set this [UserRoleObj::constructor $class $this $name]
  32.     return $this
  33. }
  34.  
  35. selfPromoter Role {this} {
  36.     RoleDbObj promote $this
  37. }
  38.  
  39. method RoleDbObj::addUserRoleLinks {this} {
  40.     set typeSpec [getObjectSpec [$wmttoolObj objectHdlr] User ""]
  41.     if {"$typeSpec" != ""} {
  42.     set icon [$typeSpec smallIcon]
  43.     } else {
  44.     set icon ""
  45.     }
  46.  
  47.     foreach user [$this users [$this getParent SecurityLevel]] {
  48.     set currentList($user) 1
  49.     }
  50.     set objectSpecList ""
  51.     foreach user [[$this getParent Corporate] users] {
  52.     if [info exists currentList($user)] continue
  53.     lappend objectSpecList [list $icon [$user name]]
  54.     }
  55.  
  56.     if [lempty $objectSpecList] {
  57.     wmtkinfo "There are no users to create a link to"
  58.     return
  59.     }
  60.  
  61.     require "browsviewd.tcl"
  62.     set box $wmttoolObj.newUserRoleL
  63.     ClassMaker::extend BrowsViewDialog NewUserRoleLBrowsViewDialog dbObj
  64.     NewUserRoleLBrowsViewDialog new $box \
  65.     -title "New User Role Link(s)" \
  66.     -message "Select User(s) to create a link to" \
  67.     -headerSpecList {{Name 20 ascii {increasing 1}}} \
  68.     -objectSpecList $objectSpecList \
  69.     -dbObj $this \
  70.     -cancelPressed {%this delete} \
  71.     -okPressed {
  72.         set role [%this dbObj]
  73.         set securityLevel [$role getParent SecurityLevel]
  74.         set script ""
  75.         set message "Creating link(s) from role '[$role name]' to user"
  76.         foreach object [[%this view] selectedSet] {
  77.         set userName [$object label]
  78.         if {"$script" != ""} {
  79.             append script " ;"
  80.             append message ","
  81.         }
  82.         append script " $securityLevel createUserRoleLink \
  83.             $userName $role defaultOff"
  84.         append message " '$userName'"
  85.         }
  86.         $wmttoolObj startCommand tcl "$script" "" "$message" {1 0} 1
  87.         %this delete
  88.     }
  89.     $box popUp
  90. }
  91.  
  92. proc RoleDbObj::associations {} {
  93.     return {userLinks}
  94. }
  95.  
  96. proc RoleDbObj::childTypes {assoc} {
  97.     if {[lsearch -exact "[RoleDbObj::associations]" "$assoc"] == -1} {
  98.     return ""
  99.     }
  100.     set childTypes [BrowserProcs::childTypes $assoc]
  101.     case "$childTypes" in {
  102.     {UserRoleLink} {
  103.         return {UserLink}
  104.     }
  105.     {default} {
  106.         return "$childTypes"
  107.     }
  108.     }
  109. }
  110.  
  111. proc RoleDbObj::controlledLists {} {
  112.     return ""
  113. }
  114.  
  115. proc RoleDbObj::infoProperties {} {
  116.     return [BrowserProcs::infoProperties]
  117. }
  118.  
  119. method RoleDbObj::userLinks {this} {
  120.     return [$this Role::userLinks [[$this info] set SecurityLevel]]
  121. }
  122.  
  123. # Do not delete this line -- regeneration end marker
  124.  
  125.