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

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