home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / komix / DATA.Z / roledbobj.tcl < prev    next >
Text File  |  1997-10-16  |  3KB  |  131 lines

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