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

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