1 # ===================================================================== 2 # group-editor.rc: W-TW grant group-editor privileges if appropriate. 3 # 4 # Copyright (c) 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 # Make this field suitable for easy pattern-matching. 26 if (~ $'tbl_group.g_editor' *[a-z]*) { 27 ~ $'tbl_group.g_editor' ,* || tbl_group.g_editor = ,$'tbl_group.g_editor' 28 ~ $'tbl_group.g_editor' *, || tbl_group.g_editor = $'tbl_group.g_editor', 29 30 # Grant group-level editor privileges if appropriate. This can be 31 # safely done here without risking to grant global editor privileges, 32 # because the relevant session token has already been set by 33 # authlib.rc . In this way, while CSA_SESSION(9) always contains the 34 # *real* authority, TNS_AUTH_GRP from this point on will contain the 35 # *effective* authority for this run. 36 37 if (!~ $CSA_AUTH_USER () && 38 csvMatch $CSA_AUTH_USER $'tbl_group.g_editor') { 39 ~ $TNS_AUTH_GRP ,* || TNS_AUTH_GRP = ,$TNS_AUTH_GRP 40 TNS_AUTH_GRP = editor$TNS_AUTH_GRP 41 } 42 } 43 44 if (~ ,$TNS_AUTH_GRP, *,editor,*) { 45 tpl.if.tw.editor = () 46 tpl.fi.tw.editor = () 47 } else { 48 tpl.if.tw.editor = '(::DEL:)' 49 tpl.fi.tw.editor = '(:DEL::)' 50 } 51 52 #EOF