Changeset 12690
- Timestamp:
- 10/02/11 04:59:41 (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UnitTestContrib/test/unit/AdminOnlyAccessControlTests.pm
r12689 r12690 1 package AdminOnlyAccessControlTests; 1 2 use strict; 2 3 package AdminOnlyAccessControlTests; 3 use warnings; 4 4 5 5 #Sven wishes he could use ISA AccessControlTest, but the unit test system doesn't do inherited test subs … … 8 8 our @ISA = qw( FoswikiFnTestCase ); 9 9 10 use Foswiki (); 11 use Foswiki::Address (); 12 use Foswiki::Meta (); 13 use Foswiki::Plugins (); 14 10 15 # For Anchor test 11 use Foswiki::UI ;16 use Foswiki::UI (); 12 17 13 18 sub 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 16 22 return $self; 17 23 } 18 24 19 25 sub 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 ); 24 31 25 32 #can't change to AdminOnlyAccessControl here, as we need to be able to create topics. 26 33 #$Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess' 34 35 return; 27 36 } 28 37 … … 56 65 $topicObject = 57 66 Foswiki::Meta->new( $this->{session}, $this->{users_web}, 58 "ReservoirDogsGroup", << THIS);67 "ReservoirDogsGroup", <<"THIS"); 59 68 * Set GROUP = MrWhite, $this->{users_web}.MrBlue 60 69 THIS 61 70 $topicObject->save(); 62 71 72 return; 63 73 } 64 74 … … 66 76 my $this = shift; 67 77 $this->SUPER::tear_down(); 78 79 return; 68 80 } 69 81 … … 75 87 $this->assert( !$topicObject->haveAccess( $mode, $user ), 76 88 "$user $mode $web.$topic" ); 89 90 return; 77 91 } 78 92 … … 84 98 $this->assert( $topicObject->haveAccess( $mode, $user ), 85 99 "$user $mode $web.$topic" ); 100 101 return; 86 102 } 87 103 … … 95 111 my $topicObject = 96 112 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 97 $this->{test_topic}, << THIS);113 $this->{test_topic}, <<"THIS"); 98 114 If DENYTOPIC is set to a list of wikinames 99 115 * people in the list will be DENIED. … … 105 121 $this->{session}->finish(); 106 122 $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; 116 133 } 117 134 … … 121 138 my $topicObject = 122 139 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 123 $this->{test_topic}, << THIS);140 $this->{test_topic}, <<'THIS'); 124 141 If DENYTOPIC is set to empty ( i.e. Set DENYTOPIC = ) 125 142 * access is PERMITTED _i.e _ no-one is denied access to this topic … … 130 147 $this->{session}->finish(); 131 148 $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; 140 158 } 141 159 … … 145 163 my $topicObject = 146 164 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 147 $this->{test_topic}, << THIS);165 $this->{test_topic}, <<'THIS'); 148 166 If DENYTOPIC is set to empty ( i.e. Set DENYTOPIC = ) 149 167 * access is PERMITTED _i.e _ no-one is denied access to this topic … … 154 172 $this->{session}->finish(); 155 173 $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; 163 183 } 164 184 … … 168 188 my $topicObject = 169 189 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 170 $this->{test_topic}, << THIS);190 $this->{test_topic}, <<'THIS'); 171 191 If DENYTOPIC is set to empty ( i.e. Set DENYTOPIC = ) 172 192 * access is PERMITTED _i.e _ no-one is denied access to this topic … … 177 197 $this->{session}->finish(); 178 198 $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; 186 208 } 187 209 … … 191 213 my $topicObject = 192 214 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 193 $this->{test_topic}, << THIS);215 $this->{test_topic}, <<'THIS'); 194 216 If ALLOWTOPIC is set 195 217 1. people in the list are PERMITTED … … 201 223 $this->{session}->finish(); 202 224 $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; 211 234 } 212 235 … … 217 240 my $topicObject = 218 241 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 219 $this->{test_topic}, << THIS);242 $this->{test_topic}, <<'THIS'); 220 243 If ALLOWTOPIC is set 221 244 1. people in the list are PERMITTED … … 225 248 $topicObject->save(); 226 249 227 my $topicquery = new Unit::Request("");250 my $topicquery = Unit::Request->new(""); 228 251 $topicquery->path_info("/$this->{test_web}/$this->{test_topic}"); 229 252 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; 251 275 } 252 276 … … 258 282 my $topicObject = 259 283 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 260 $this->{test_topic}, << THIS);284 $this->{test_topic}, <<'THIS'); 261 285 If ALLOWTOPIC is set 262 286 1. people in the list are PERMITTED … … 266 290 $topicObject->save(); 267 291 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; 288 314 } 289 315 … … 294 320 my $topicObject = 295 321 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 296 $this->{test_topic}, << THIS);322 $this->{test_topic}, <<'THIS'); 297 323 If ALLOWTOPIC is set 298 324 1. people in the list are PERMITTED … … 310 336 $topicObject->save(); 311 337 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; 332 360 } 333 361 … … 337 365 my $topicObject = 338 366 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 339 $Foswiki::cfg{WebPrefsTopicName}, << THIS);367 $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 340 368 If DENYWEB is set to a list of wikiname 341 369 * people in the list are DENIED access … … 344 372 $topicObject->save(); 345 373 346 # re new Foswiki, so WebPreferences gets re-read374 # reFoswiki->new, so WebPreferences gets re-read 347 375 $topicObject = Foswiki::Meta->new( 348 376 $this->{session}, $this->{test_web}, … … 353 381 $this->{session}->finish(); 354 382 $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; 363 393 } 364 394 … … 369 399 $this->{session}, 370 400 $this->{test_web}, $Foswiki::cfg{WebPrefsTopicName}, 371 << THIS401 <<'THIS' 372 402 If ALLOWWEB is set to a list of wikinames 373 403 * people in the list will be PERMITTED … … 385 415 $topicObject->save(); 386 416 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; 398 430 } 399 431 … … 403 435 my $topicObject = Foswiki::Meta->new( 404 436 $this->{session}, $this->{test_web}, $this->{test_topic}, 405 << THIS437 <<'THIS' 406 438 If ALLOWTOPIC is set 407 439 1. people in the list are PERMITTED … … 413 445 $topicObject->save(); 414 446 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; 426 460 } 427 461 … … 453 487 " 'VIEW' $this->{test_web}.$this->{test_topic}" 454 488 ); 489 490 return; 455 491 } 456 492 … … 459 495 my $this = shift; 460 496 461 my $text = << THIS;497 my $text = <<'THIS'; 462 498 * Set ALLOWTOPICVIEW = %USERSWEB%.MrGreen 463 499 THIS … … 467 503 $topicObject->save(); 468 504 469 # re new Foswiki, so WebPreferences gets re-read470 $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(); 473 509 474 510 $topicObject = … … 476 512 $this->{test_topic} ); 477 513 $this->_checkSettings($topicObject); 514 515 return; 478 516 } 479 517 … … 494 532 $topicObject->save(); 495 533 496 # re new Foswiki, so WebPreferences gets re-read497 $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(); 500 538 501 539 $topicObject = … … 504 542 505 543 $this->_checkSettings($topicObject); 544 545 return; 506 546 } 507 547 … … 510 550 my $this = shift; 511 551 512 my $text = << THIS;552 my $text = <<'THIS'; 513 553 * Set ALLOWTOPICVIEW = %USERSWEB%.MrOrange 514 554 THIS … … 525 565 $topicObject->save(); 526 566 527 # re new Foswiki, so WebPreferences gets re-read528 $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(); 531 571 532 572 $topicObject = … … 534 574 $this->{test_topic} ); 535 575 $this->_checkSettings($topicObject); 576 577 return; 536 578 } 537 579 … … 551 593 $topicObject = 552 594 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 553 $Foswiki::cfg{WebPrefsTopicName}, << THIS);595 $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 554 596 * Set ALLOWWEBVIEW = MrGreen 555 597 THIS … … 561 603 $topicObject = 562 604 Foswiki::Meta->new( $this->{session}, $subweb, 563 $Foswiki::cfg{WebPrefsTopicName}, << THIS);605 $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 564 606 * Set ALLOWWEBVIEW = MrOrange 565 607 THIS … … 567 609 $this->{session}->finish(); 568 610 $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 569 $this->{session} = new Foswiki();611 $this->{session} = Foswiki->new(); 570 612 $this->DENIED( "VIEW", $MrOrange, $subweb ); 571 613 $this->DENIED( "VIEW", $MrGreen, $subweb ); … … 573 615 $this->DENIED( "VIEW", $MrOrange ); 574 616 $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 617 618 return; 575 619 } 576 620 … … 586 630 my $topicObject = 587 631 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 588 $Foswiki::cfg{WebPrefsTopicName}, << THIS);632 $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 589 633 * Set ALLOWWEBVIEW = MrGreen 590 634 * Set FINALPREFERENCES = ALLOWWEBVIEW … … 597 641 $topicObject = 598 642 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'); 644 THIS 645 $topicObject->save(); 646 $this->{session}->finish(); 647 $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 648 $this->{session} = Foswiki->new(); 605 649 $this->DENIED( "VIEW", $MrGreen, $subweb ); 606 650 $this->DENIED( "VIEW", $MrOrange, $subweb ); … … 608 652 $this->DENIED( "VIEW", $MrOrange ); 609 653 $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 654 655 return; 610 656 } 611 657 … … 621 667 my $topicObject = 622 668 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 623 $Foswiki::cfg{WebPrefsTopicName}, << THIS);669 $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 624 670 * Set ALLOWWEBVIEW = MrGreen 625 671 * Set FINALPREFERENCES = ALLOWWEBVIEW … … 632 678 $topicObject = 633 679 Foswiki::Meta->new( $this->{session}, $subweb, 634 $Foswiki::cfg{WebPrefsTopicName}, << THIS);680 $Foswiki::cfg{WebPrefsTopicName}, <<'THIS'); 635 681 * Set ALLOWWEBVIEW = MrOrange 636 682 THIS … … 638 684 $this->{session}->finish(); 639 685 $Foswiki::cfg{AccessControl} = 'Foswiki::Access::AdminOnlyAccess'; 640 $this->{session} = new Foswiki();686 $this->{session} = Foswiki->new(); 641 687 $this->DENIED( "VIEW", $MrOrange, $subweb ); 642 688 $this->DENIED( "VIEW", $MrGreen, $subweb ); … … 644 690 $this->DENIED( "VIEW", $MrOrange ); 645 691 $this->PERMITTED( "VIEW", 'BaseUserMapping_333' ); 692 693 return; 646 694 } 647 695 … … 657 705 my $topicObject = Foswiki::Meta->new( 658 706 $this->{session}, $this->{test_web}, $test_topic, 659 << THIS707 <<'THIS' 660 708 If there is an anchor, and some access restrictions, 661 709 anchor is preserved after login. … … 668 716 669 717 # Request the page with the full UI 670 my $query = new Unit::Request(718 my $query = Unit::Request->new( 671 719 { 672 720 webName => [ $this->{test_web} ], … … 684 732 sub { 685 733 $Foswiki::Plugins::SESSION->{response} = 686 &Foswiki::UI::handleRequest($query);734 Foswiki::UI::handleRequest($query); 687 735 } 688 736 ); … … 720 768 721 769 # Get the redirected page after login 770 771 return; 722 772 } 723 773
Note: See TracChangeset
for help on using the changeset viewer.
