Changeset 12690


Ignore:
Timestamp:
10/02/11 04:59:41 (20 months ago)
Author:
PaulHarvey
Message:

Item11121: address perlcriticisms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UnitTestContrib/test/unit/AdminOnlyAccessControlTests.pm

    r12689 r12690  
     1package AdminOnlyAccessControlTests; 
    12use strict; 
    2  
    3 package AdminOnlyAccessControlTests; 
     3use warnings; 
    44 
    55#Sven wishes he could use ISA AccessControlTest, but the unit test system doesn't do inherited test subs 
     
    88our @ISA = qw( FoswikiFnTestCase ); 
    99 
     10use Foswiki          (); 
     11use Foswiki::Address (); 
     12use Foswiki::Meta    (); 
     13use Foswiki::Plugins (); 
     14 
    1015# For Anchor test 
    11 use Foswiki::UI; 
     16use Foswiki::UI (); 
    1217 
    1318sub new { 
    14     my $class = shift; 
    15     my $self = $class->SUPER::new( 'AccessControl', @_ ); 
     19    my ( $class, @args ) = @_; 
     20    my $self = $class->SUPER::new( 'AccessControl', @args ); 
     21 
    1622    return $self; 
    1723} 
    1824 
    1925sub loadExtraConfig { 
    20     my $this    = shift;    # the Test::Unit::TestCase object 
    21     my $context = shift; 
    22  
    23     $this->SUPER::loadExtraConfig( $context, @_ ); 
     26    my ( $this, $context, @args ) = @_; 
     27 
     28    # $this - the Test::Unit::TestCase object 
     29 
     30    $this->SUPER::loadExtraConfig( $context, @args ); 
    2431 
    2532#can't change to AdminOnlyAccessControl here, as we need to be able to create topics. 
    2633#$Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess' 
     34 
     35    return; 
    2736} 
    2837 
     
    5665    $topicObject = 
    5766      Foswiki::Meta->new( $this->{session}, $this->{users_web}, 
    58         "ReservoirDogsGroup", <<THIS); 
     67        "ReservoirDogsGroup", <<"THIS"); 
    5968   * Set GROUP = MrWhite, $this->{users_web}.MrBlue 
    6069THIS 
    6170    $topicObject->save(); 
    6271 
     72    return; 
    6373} 
    6474 
     
    6676    my $this = shift; 
    6777    $this->SUPER::tear_down(); 
     78 
     79    return; 
    6880} 
    6981 
     
    7587    $this->assert( !$topicObject->haveAccess( $mode, $user ), 
    7688        "$user $mode $web.$topic" ); 
     89 
     90    return; 
    7791} 
    7892 
     
    8498    $this->assert( $topicObject->haveAccess( $mode, $user ), 
    8599        "$user $mode $web.$topic" ); 
     100 
     101    return; 
    86102} 
    87103 
     
    95111    my $topicObject = 
    96112      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    97         $this->{test_topic}, <<THIS); 
     113        $this->{test_topic}, <<"THIS"); 
    98114If DENYTOPIC is set to a list of wikinames 
    99115    * people in the list will be DENIED. 
     
    105121    $this->{session}->finish(); 
    106122    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    107     $this->{session} = new Foswiki(); 
    108  
    109     $this->DENIED( "VIEW", $MrGreen ); 
    110     $this->DENIED( "VIEW", $MrYellow ); 
    111     $this->DENIED( "VIEW", $MrOrange ); 
    112     $this->DENIED( "VIEW", $MrWhite ); 
    113     $this->DENIED( "view", $MrBlue ); 
    114     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
    115  
     123    $this->{session} = Foswiki->new(); 
     124 
     125    $this->DENIED( "VIEW", $MrGreen ); 
     126    $this->DENIED( "VIEW", $MrYellow ); 
     127    $this->DENIED( "VIEW", $MrOrange ); 
     128    $this->DENIED( "VIEW", $MrWhite ); 
     129    $this->DENIED( "view", $MrBlue ); 
     130    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     131 
     132    return; 
    116133} 
    117134 
     
    121138    my $topicObject = 
    122139      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    123         $this->{test_topic}, <<THIS); 
     140        $this->{test_topic}, <<'THIS'); 
    124141If DENYTOPIC is set to empty ( i.e. Set DENYTOPIC = ) 
    125142    * access is PERMITTED _i.e _ no-one is denied access to this topic 
     
    130147    $this->{session}->finish(); 
    131148    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    132     $this->{session} = new Foswiki(); 
    133     $this->DENIED( "VIEW", $MrGreen ); 
    134     $this->DENIED( "VIEW", $MrYellow ); 
    135     $this->DENIED( "VIEW", $MrOrange ); 
    136     $this->DENIED( "VIEW", $MrWhite ); 
    137     $this->DENIED( "view", $MrBlue ); 
    138     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
    139  
     149    $this->{session} = Foswiki->new(); 
     150    $this->DENIED( "VIEW", $MrGreen ); 
     151    $this->DENIED( "VIEW", $MrYellow ); 
     152    $this->DENIED( "VIEW", $MrOrange ); 
     153    $this->DENIED( "VIEW", $MrWhite ); 
     154    $this->DENIED( "view", $MrBlue ); 
     155    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     156 
     157    return; 
    140158} 
    141159 
     
    145163    my $topicObject = 
    146164      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    147         $this->{test_topic}, <<THIS); 
     165        $this->{test_topic}, <<'THIS'); 
    148166If DENYTOPIC is set to empty ( i.e. Set DENYTOPIC = ) 
    149167    * access is PERMITTED _i.e _ no-one is denied access to this topic 
     
    154172    $this->{session}->finish(); 
    155173    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    156     $this->{session} = new Foswiki(); 
    157     $this->DENIED( "VIEW", $MrGreen ); 
    158     $this->DENIED( "VIEW", $MrYellow ); 
    159     $this->DENIED( "VIEW", $MrOrange ); 
    160     $this->DENIED( "VIEW", $MrWhite ); 
    161     $this->DENIED( "view", $MrBlue ); 
    162     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     174    $this->{session} = Foswiki->new(); 
     175    $this->DENIED( "VIEW", $MrGreen ); 
     176    $this->DENIED( "VIEW", $MrYellow ); 
     177    $this->DENIED( "VIEW", $MrOrange ); 
     178    $this->DENIED( "VIEW", $MrWhite ); 
     179    $this->DENIED( "view", $MrBlue ); 
     180    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     181 
     182    return; 
    163183} 
    164184 
     
    168188    my $topicObject = 
    169189      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    170         $this->{test_topic}, <<THIS); 
     190        $this->{test_topic}, <<'THIS'); 
    171191If DENYTOPIC is set to empty ( i.e. Set DENYTOPIC = ) 
    172192    * access is PERMITTED _i.e _ no-one is denied access to this topic 
     
    177197    $this->{session}->finish(); 
    178198    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    179     $this->{session} = new Foswiki(); 
    180     $this->DENIED( "VIEW", $MrGreen ); 
    181     $this->DENIED( "VIEW", $MrYellow ); 
    182     $this->DENIED( "VIEW", $MrOrange ); 
    183     $this->DENIED( "VIEW", $MrWhite ); 
    184     $this->DENIED( "view", $MrBlue ); 
    185     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     199    $this->{session} = Foswiki->new(); 
     200    $this->DENIED( "VIEW", $MrGreen ); 
     201    $this->DENIED( "VIEW", $MrYellow ); 
     202    $this->DENIED( "VIEW", $MrOrange ); 
     203    $this->DENIED( "VIEW", $MrWhite ); 
     204    $this->DENIED( "view", $MrBlue ); 
     205    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     206 
     207    return; 
    186208} 
    187209 
     
    191213    my $topicObject = 
    192214      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    193         $this->{test_topic}, <<THIS); 
     215        $this->{test_topic}, <<'THIS'); 
    194216If ALLOWTOPIC is set 
    195217   1. people in the list are PERMITTED 
     
    201223    $this->{session}->finish(); 
    202224    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    203     $this->{session} = new Foswiki(); 
    204     $this->DENIED( "VIEW", $MrOrange ); 
    205     $this->DENIED( "VIEW", $MrGreen ); 
    206     $this->DENIED( "VIEW", $MrYellow ); 
    207     $this->DENIED( "VIEW", $MrWhite ); 
    208     $this->DENIED( "view", $MrBlue ); 
    209     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
    210  
     225    $this->{session} = Foswiki->new(); 
     226    $this->DENIED( "VIEW", $MrOrange ); 
     227    $this->DENIED( "VIEW", $MrGreen ); 
     228    $this->DENIED( "VIEW", $MrYellow ); 
     229    $this->DENIED( "VIEW", $MrWhite ); 
     230    $this->DENIED( "view", $MrBlue ); 
     231    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     232 
     233    return; 
    211234} 
    212235 
     
    217240    my $topicObject = 
    218241      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    219         $this->{test_topic}, <<THIS); 
     242        $this->{test_topic}, <<'THIS'); 
    220243If ALLOWTOPIC is set 
    221244   1. people in the list are PERMITTED 
     
    225248    $topicObject->save(); 
    226249 
    227     my $topicquery = new Unit::Request(""); 
     250    my $topicquery = Unit::Request->new(""); 
    228251    $topicquery->path_info("/$this->{test_web}/$this->{test_topic}"); 
    229252 
    230     # renew Foswiki, so WebPreferences gets re-read 
    231     $this->{session}->finish(); 
    232     $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    233     $this->{session} = new Foswiki( undef, $topicquery ); 
    234     $this->DENIED( "VIEW", $MrOrange ); 
    235     $this->{session}->finish(); 
    236     $this->{session} = new Foswiki( undef, $topicquery ); 
    237     $this->DENIED( "VIEW", $MrGreen ); 
    238     $this->{session}->finish(); 
    239     $this->{session} = new Foswiki( undef, $topicquery ); 
    240     $this->DENIED( "VIEW", $MrYellow ); 
    241     $this->{session}->finish(); 
    242     $this->{session} = new Foswiki( undef, $topicquery ); 
    243     $this->DENIED( "VIEW", $MrWhite ); 
    244     $this->{session}->finish(); 
    245     $this->{session} = new Foswiki( undef, $topicquery ); 
    246     $this->DENIED( "view", $MrBlue ); 
    247     $this->{session}->finish(); 
    248     $this->{session} = new Foswiki(); 
    249     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
    250  
     253    # reFoswiki->new, so WebPreferences gets re-read 
     254    $this->{session}->finish(); 
     255    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
     256    $this->{session} = Foswiki->new( undef, $topicquery ); 
     257    $this->DENIED( "VIEW", $MrOrange ); 
     258    $this->{session}->finish(); 
     259    $this->{session} = Foswiki->new( undef, $topicquery ); 
     260    $this->DENIED( "VIEW", $MrGreen ); 
     261    $this->{session}->finish(); 
     262    $this->{session} = Foswiki->new( undef, $topicquery ); 
     263    $this->DENIED( "VIEW", $MrYellow ); 
     264    $this->{session}->finish(); 
     265    $this->{session} = Foswiki->new( undef, $topicquery ); 
     266    $this->DENIED( "VIEW", $MrWhite ); 
     267    $this->{session}->finish(); 
     268    $this->{session} = Foswiki->new( undef, $topicquery ); 
     269    $this->DENIED( "view", $MrBlue ); 
     270    $this->{session}->finish(); 
     271    $this->{session} = Foswiki->new(); 
     272    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     273 
     274    return; 
    251275} 
    252276 
     
    258282    my $topicObject = 
    259283      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    260         $this->{test_topic}, <<THIS); 
     284        $this->{test_topic}, <<'THIS'); 
    261285If ALLOWTOPIC is set 
    262286   1. people in the list are PERMITTED 
     
    266290    $topicObject->save(); 
    267291 
    268     # renew Foswiki, so WebPreferences gets re-read 
    269     $this->{session}->finish(); 
    270     $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    271     $this->{session} = new Foswiki(); 
    272     $this->DENIED( "VIEW", $MrOrange ); 
    273     $this->{session}->finish(); 
    274     $this->{session} = new Foswiki(); 
    275     $this->DENIED( "VIEW", $MrGreen ); 
    276     $this->{session}->finish(); 
    277     $this->{session} = new Foswiki(); 
    278     $this->DENIED( "VIEW", $MrYellow ); 
    279     $this->{session}->finish(); 
    280     $this->{session} = new Foswiki(); 
    281     $this->DENIED( "VIEW", $MrWhite ); 
    282     $this->{session}->finish(); 
    283     $this->{session} = new Foswiki(); 
    284     $this->DENIED( "view", $MrBlue ); 
    285     $this->{session}->finish(); 
    286     $this->{session} = new Foswiki(); 
    287     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     292    # reFoswiki->new, so WebPreferences gets re-read 
     293    $this->{session}->finish(); 
     294    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
     295    $this->{session} = Foswiki->new(); 
     296    $this->DENIED( "VIEW", $MrOrange ); 
     297    $this->{session}->finish(); 
     298    $this->{session} = Foswiki->new(); 
     299    $this->DENIED( "VIEW", $MrGreen ); 
     300    $this->{session}->finish(); 
     301    $this->{session} = Foswiki->new(); 
     302    $this->DENIED( "VIEW", $MrYellow ); 
     303    $this->{session}->finish(); 
     304    $this->{session} = Foswiki->new(); 
     305    $this->DENIED( "VIEW", $MrWhite ); 
     306    $this->{session}->finish(); 
     307    $this->{session} = Foswiki->new(); 
     308    $this->DENIED( "view", $MrBlue ); 
     309    $this->{session}->finish(); 
     310    $this->{session} = Foswiki->new(); 
     311    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     312 
     313    return; 
    288314} 
    289315 
     
    294320    my $topicObject = 
    295321      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    296         $this->{test_topic}, <<THIS); 
     322        $this->{test_topic}, <<'THIS'); 
    297323If ALLOWTOPIC is set 
    298324   1. people in the list are PERMITTED 
     
    310336    $topicObject->save(); 
    311337 
    312     # renew Foswiki, so WebPreferences gets re-read 
    313     $this->{session}->finish(); 
    314     $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    315     $this->{session} = new Foswiki(); 
    316     $this->DENIED( "VIEW", $MrOrange ); 
    317     $this->{session}->finish(); 
    318     $this->{session} = new Foswiki(); 
    319     $this->DENIED( "VIEW", $MrGreen ); 
    320     $this->{session}->finish(); 
    321     $this->{session} = new Foswiki(); 
    322     $this->DENIED( "VIEW", $MrYellow ); 
    323     $this->{session}->finish(); 
    324     $this->{session} = new Foswiki(); 
    325     $this->DENIED( "VIEW", $MrWhite ); 
    326     $this->{session}->finish(); 
    327     $this->{session} = new Foswiki(); 
    328     $this->DENIED( "view", $MrBlue ); 
    329     $this->{session}->finish(); 
    330     $this->{session} = new Foswiki(); 
    331     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     338    # reFoswiki->new, so WebPreferences gets re-read 
     339    $this->{session}->finish(); 
     340    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
     341    $this->{session} = Foswiki->new(); 
     342    $this->DENIED( "VIEW", $MrOrange ); 
     343    $this->{session}->finish(); 
     344    $this->{session} = Foswiki->new(); 
     345    $this->DENIED( "VIEW", $MrGreen ); 
     346    $this->{session}->finish(); 
     347    $this->{session} = Foswiki->new(); 
     348    $this->DENIED( "VIEW", $MrYellow ); 
     349    $this->{session}->finish(); 
     350    $this->{session} = Foswiki->new(); 
     351    $this->DENIED( "VIEW", $MrWhite ); 
     352    $this->{session}->finish(); 
     353    $this->{session} = Foswiki->new(); 
     354    $this->DENIED( "view", $MrBlue ); 
     355    $this->{session}->finish(); 
     356    $this->{session} = Foswiki->new(); 
     357    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     358 
     359    return; 
    332360} 
    333361 
     
    337365    my $topicObject = 
    338366      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    339         $Foswiki::cfg{WebPrefsTopicName}, <<THIS); 
     367        $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 
    340368If DENYWEB is set to a list of wikiname 
    341369    * people in the list are DENIED access 
     
    344372    $topicObject->save(); 
    345373 
    346     # renew Foswiki, so WebPreferences gets re-read 
     374    # reFoswiki->new, so WebPreferences gets re-read 
    347375    $topicObject = Foswiki::Meta->new( 
    348376        $this->{session},    $this->{test_web}, 
     
    353381    $this->{session}->finish(); 
    354382    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    355     $this->{session} = new Foswiki(); 
    356  
    357     $this->DENIED( "VIEW", $MrOrange ); 
    358     $this->DENIED( "VIEW", $MrGreen ); 
    359     $this->DENIED( "VIEW", $MrYellow ); 
    360     $this->DENIED( "VIEW", $MrWhite ); 
    361     $this->DENIED( "view", $MrBlue ); 
    362     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     383    $this->{session} = Foswiki->new(); 
     384 
     385    $this->DENIED( "VIEW", $MrOrange ); 
     386    $this->DENIED( "VIEW", $MrGreen ); 
     387    $this->DENIED( "VIEW", $MrYellow ); 
     388    $this->DENIED( "VIEW", $MrWhite ); 
     389    $this->DENIED( "view", $MrBlue ); 
     390    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     391 
     392    return; 
    363393} 
    364394 
     
    369399        $this->{session}, 
    370400        $this->{test_web}, $Foswiki::cfg{WebPrefsTopicName}, 
    371         <<THIS 
     401        <<'THIS' 
    372402If ALLOWWEB is set to a list of wikinames 
    373403    * people in the list will be PERMITTED 
     
    385415    $topicObject->save(); 
    386416 
    387     # renew Foswiki, so WebPreferences gets re-read 
    388     $this->{session}->finish(); 
    389     $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    390     $this->{session} = new Foswiki(); 
    391  
    392     $this->DENIED( "VIEW", $MrOrange ); 
    393     $this->DENIED( "VIEW", $MrGreen ); 
    394     $this->DENIED( "VIEW", $MrYellow ); 
    395     $this->DENIED( "VIEW", $MrWhite ); 
    396     $this->DENIED( "view", $MrBlue ); 
    397     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     417    # reFoswiki->new, so WebPreferences gets re-read 
     418    $this->{session}->finish(); 
     419    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
     420    $this->{session} = Foswiki->new(); 
     421 
     422    $this->DENIED( "VIEW", $MrOrange ); 
     423    $this->DENIED( "VIEW", $MrGreen ); 
     424    $this->DENIED( "VIEW", $MrYellow ); 
     425    $this->DENIED( "VIEW", $MrWhite ); 
     426    $this->DENIED( "view", $MrBlue ); 
     427    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     428 
     429    return; 
    398430} 
    399431 
     
    403435    my $topicObject = Foswiki::Meta->new( 
    404436        $this->{session}, $this->{test_web}, $this->{test_topic}, 
    405         <<THIS 
     437        <<'THIS' 
    406438If ALLOWTOPIC is set 
    407439   1. people in the list are PERMITTED 
     
    413445    $topicObject->save(); 
    414446 
    415     # renew Foswiki, so WebPreferences gets re-read 
    416     $this->{session}->finish(); 
    417     $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    418     $this->{session} = new Foswiki(); 
    419  
    420     $this->DENIED( "VIEW", $MrOrange ); 
    421     $this->DENIED( "VIEW", $MrGreen ); 
    422     $this->DENIED( "VIEW", $MrYellow ); 
    423     $this->DENIED( "VIEW", $MrWhite ); 
    424     $this->DENIED( "view", $MrBlue ); 
    425     $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     447    # reFoswiki->new, so WebPreferences gets re-read 
     448    $this->{session}->finish(); 
     449    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
     450    $this->{session} = Foswiki->new(); 
     451 
     452    $this->DENIED( "VIEW", $MrOrange ); 
     453    $this->DENIED( "VIEW", $MrGreen ); 
     454    $this->DENIED( "VIEW", $MrYellow ); 
     455    $this->DENIED( "VIEW", $MrWhite ); 
     456    $this->DENIED( "view", $MrBlue ); 
     457    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     458 
     459    return; 
    426460} 
    427461 
     
    453487        " 'VIEW' $this->{test_web}.$this->{test_topic}" 
    454488    ); 
     489 
     490    return; 
    455491} 
    456492 
     
    459495    my $this = shift; 
    460496 
    461     my $text = <<THIS; 
     497    my $text = <<'THIS'; 
    462498   * Set ALLOWTOPICVIEW = %USERSWEB%.MrGreen 
    463499THIS 
     
    467503    $topicObject->save(); 
    468504 
    469     # renew Foswiki, so WebPreferences gets re-read 
    470     $this->{session}->finish(); 
    471     $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    472     $this->{session} = new Foswiki(); 
     505    # reFoswiki->new, so WebPreferences gets re-read 
     506    $this->{session}->finish(); 
     507    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
     508    $this->{session} = Foswiki->new(); 
    473509 
    474510    $topicObject = 
     
    476512        $this->{test_topic} ); 
    477513    $this->_checkSettings($topicObject); 
     514 
     515    return; 
    478516} 
    479517 
     
    494532    $topicObject->save(); 
    495533 
    496     # renew Foswiki, so WebPreferences gets re-read 
    497     $this->{session}->finish(); 
    498     $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    499     $this->{session} = new Foswiki(); 
     534    # reFoswiki->new, so WebPreferences gets re-read 
     535    $this->{session}->finish(); 
     536    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
     537    $this->{session} = Foswiki->new(); 
    500538 
    501539    $topicObject = 
     
    504542 
    505543    $this->_checkSettings($topicObject); 
     544 
     545    return; 
    506546} 
    507547 
     
    510550    my $this = shift; 
    511551 
    512     my $text = <<THIS; 
     552    my $text = <<'THIS'; 
    513553   * Set ALLOWTOPICVIEW = %USERSWEB%.MrOrange 
    514554THIS 
     
    525565    $topicObject->save(); 
    526566 
    527     # renew Foswiki, so WebPreferences gets re-read 
    528     $this->{session}->finish(); 
    529     $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    530     $this->{session} = new Foswiki(); 
     567    # reFoswiki->new, so WebPreferences gets re-read 
     568    $this->{session}->finish(); 
     569    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
     570    $this->{session} = Foswiki->new(); 
    531571 
    532572    $topicObject = 
     
    534574        $this->{test_topic} ); 
    535575    $this->_checkSettings($topicObject); 
     576 
     577    return; 
    536578} 
    537579 
     
    551593    $topicObject = 
    552594      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    553         $Foswiki::cfg{WebPrefsTopicName}, <<THIS); 
     595        $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 
    554596   * Set ALLOWWEBVIEW = MrGreen 
    555597THIS 
     
    561603    $topicObject = 
    562604      Foswiki::Meta->new( $this->{session}, $subweb, 
    563         $Foswiki::cfg{WebPrefsTopicName}, <<THIS); 
     605        $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 
    564606   * Set ALLOWWEBVIEW = MrOrange 
    565607THIS 
     
    567609    $this->{session}->finish(); 
    568610    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    569     $this->{session} = new Foswiki(); 
     611    $this->{session} = Foswiki->new(); 
    570612    $this->DENIED( "VIEW", $MrOrange, $subweb ); 
    571613    $this->DENIED( "VIEW", $MrGreen,  $subweb ); 
     
    573615    $this->DENIED( "VIEW", $MrOrange ); 
    574616    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     617 
     618    return; 
    575619} 
    576620 
     
    586630    my $topicObject = 
    587631      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    588         $Foswiki::cfg{WebPrefsTopicName}, <<THIS); 
     632        $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 
    589633   * Set ALLOWWEBVIEW = MrGreen 
    590634   * Set FINALPREFERENCES = ALLOWWEBVIEW 
     
    597641    $topicObject = 
    598642      Foswiki::Meta->new( $this->{session}, $subweb, 
    599         $Foswiki::cfg{WebPrefsTopicName}, <<THIS); 
    600 THIS 
    601     $topicObject->save(); 
    602     $this->{session}->finish(); 
    603     $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    604     $this->{session} = new Foswiki(); 
     643        $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 
     644THIS 
     645    $topicObject->save(); 
     646    $this->{session}->finish(); 
     647    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
     648    $this->{session} = Foswiki->new(); 
    605649    $this->DENIED( "VIEW", $MrGreen,  $subweb ); 
    606650    $this->DENIED( "VIEW", $MrOrange, $subweb ); 
     
    608652    $this->DENIED( "VIEW", $MrOrange ); 
    609653    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     654 
     655    return; 
    610656} 
    611657 
     
    621667    my $topicObject = 
    622668      Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    623         $Foswiki::cfg{WebPrefsTopicName}, <<THIS); 
     669        $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 
    624670   * Set ALLOWWEBVIEW = MrGreen 
    625671   * Set FINALPREFERENCES = ALLOWWEBVIEW 
     
    632678    $topicObject = 
    633679      Foswiki::Meta->new( $this->{session}, $subweb, 
    634         $Foswiki::cfg{WebPrefsTopicName}, <<THIS); 
     680        $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 
    635681   * Set ALLOWWEBVIEW = MrOrange 
    636682THIS 
     
    638684    $this->{session}->finish(); 
    639685    $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 
    640     $this->{session} = new Foswiki(); 
     686    $this->{session} = Foswiki->new(); 
    641687    $this->DENIED( "VIEW", $MrOrange, $subweb ); 
    642688    $this->DENIED( "VIEW", $MrGreen,  $subweb ); 
     
    644690    $this->DENIED( "VIEW", $MrOrange ); 
    645691    $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 
     692 
     693    return; 
    646694} 
    647695 
     
    657705    my $topicObject = Foswiki::Meta->new( 
    658706        $this->{session}, $this->{test_web}, $test_topic, 
    659         <<THIS 
     707        <<'THIS' 
    660708If there is an anchor, and some access restrictions, 
    661709anchor is preserved after login. 
     
    668716 
    669717    # Request the page with the full UI 
    670     my $query = new Unit::Request( 
     718    my $query = Unit::Request->new( 
    671719        { 
    672720            webName   => [ $this->{test_web} ], 
     
    684732        sub { 
    685733            $Foswiki::Plugins::SESSION->{response} = 
    686               &Foswiki::UI::handleRequest($query); 
     734              Foswiki::UI::handleRequest($query); 
    687735        } 
    688736    ); 
     
    720768 
    721769    # Get the redirected page after login 
     770 
     771    return; 
    722772} 
    723773 
Note: See TracChangeset for help on using the changeset viewer.