=================================================================== RCS file: /twiki/src/cvsroot/twiki/lib/TWiki/Access.pm,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- twiki/lib/TWiki/Access.pm 2001/07/28 08:34:42 1.1.1.1 +++ twiki/lib/TWiki/Access.pm 2002/08/16 19:44:43 1.3 @@ -98,6 +98,8 @@ # parse the " * Set (ALLOWTOPIC|DENYTOPIC)$theAccessType = " in body text my @denyList = (); my @allowList = (); + my @viewAllowList = (); + my @viewDenyList = (); foreach( split( /\n/, $theTopicText ) ) { if( /^\s+\*\sSet\s(ALLOWTOPIC|DENYTOPIC)$theAccessType\s*\=\s*(.*)/ ) { if( $2 ) { @@ -113,6 +115,24 @@ } } } + # If we are looging for CHANGE access and don't find any, CHANGE + # settings, set it from view. + if ($theAccessType eq "CHANGE") { + if( /^\s+\*\sSet\s(ALLOWTOPIC|DENYTOPIC)VIEW\s*\=\s*(.*)/ ) { + if( $2 ) { + my $allowOrDeny = $1; # "ALLOWTOPIC" or "DENYTOPIC" + my @tmpList = map { getUsersOfGroup( $_ ) } + prvGetUserList( $2 ); + ##my $tmp = join( ', ', @tmpList ); + ##&TWiki::writeDebug( " Topic $allowOrDeny$theAccessType: {$tmp}" ); + if( $allowOrDeny eq "DENYTOPIC" ) { + @viewDenyList = @tmpList; + } else { + @viewAllowList = @tmpList; + } + } + } + } } # if empty, get access permissions from preferences @@ -131,6 +151,14 @@ ##&TWiki::writeDebug( " Prefs ALLOWWEB$theAccessType: {$tmp}" ); } + if ( (! (@denyList || @allowList)) && $theAccessType eq "CHANGE" ) { + # if they are both empty, just assign the view(Deny/Allow)List + # The view*List varibles will be empty if there were no VIEW + # access permissions, so the assignment will be fast. + @denyList = @viewDenyList; + @allowList = @viewAllowList; + } + # access permission logic if( @denyList ) { if( grep { /^$theUserName$/ } @denyList ) {