1 # ===================================================================== 2 # groupAuthList: list available authorizations a W-TW group. 3 # 4 # Copyright (c) 2007,2009 Carlo Strozzi 5 # 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; version 2 dated June, 1991. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this program; if not, write to the Free Software 17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 # 19 # ===================================================================== 20 21 # ===================================================================== 22 # Local variables and functions 23 # ===================================================================== 24 25 # Note: although authorizations are global across all groups of a TW 26 # installation, I still require that a valid group be specified, in 27 # order to pick the correct response templates. 28 29 cgi.group = () 30 cgi.group.literal = () 31 cgi.what = groups 32 33 # ===================================================================== 34 # Main program 35 # ===================================================================== 36 37 # Load call arguments. 38 csaGetArgs GET 39 40 . $CSA_ROOT/lib/group-stuff.rc 41 42 . $CSA_ROOT/lib/group-editor.rc 43 44 # Set template vars to their final values. 45 tpl.var.tw.page = tw-group-filelist 46 tpl.var.tw.page.object = $'tpl.var.tw.page' 47 tpl.var.html.title = $'tpl.var.tw.group'/$'tpl.var.tw.page' 48 49 # Listing auth. groups must be available to group-level editors or they 50 # will not be able to restrict access to their pages by authorization 51 # group names. This may change in the future, as I may eventually decide 52 # to restrict this function to global-editors, in which case this check 53 # will have to be moved further up. 54 55 ~ ,$TNS_AUTH_GRP, *,editor,* || csaExit.needauth 56 57 if (csaIsFullPath --exists --quiet $CSA_TPL_ROOT/tw-group-authlist.txt) { 58 # custom template. 59 tpl.include.html.body = $CSA_TPL_ROOT/tw-group-authlist.txt 60 } else { 61 # default template. 62 tpl.include.html.body = $tw_dstem/tw-group-authlist.txt 63 } 64 65 . $CSA_ROOT/lib/tpl-stuff.rc 66 67 csaMkTemp tpl.include.tw.page 68 69 # Add more authorization object types as needed. 70 71 switch ($'cgi.what') { 72 73 case groups 74 getcolumn --no-header --input \ 75 $CSA_ROOT/var/pages/auth+dat u_group > $'tpl.include.tw.page' || 76 csaExit.fault 0003 getcolumn 77 78 case users 79 # Note: this is just a basic listing of user-IDs, 80 # see 'listUsers' for an admin-type detailed listing. 81 getcolumn --no-header --input \ 82 $CSA_ROOT/var/pages/auth+dat k_user > $'tpl.include.tw.page' || 83 csaExit.fault 0003 getcolumn 84 85 case * 86 csaExit.fault 0038 87 } 88 89 csaExit.ok --table $'tpl.include.tw.page' $tpl_file 90 91 # End of program.