Revision 2263
Added by sgarg over 19 years ago
AccessControlTest.java | ||
---|---|---|
394 | 394 |
// should be able to update the document |
395 | 395 |
|
396 | 396 |
//System.out.println(testdocument); |
397 |
// ERRRRRRRRRRRRROR |
|
398 |
//updateDocid(newdocid + ".5", testdocument, SUCCESS, false); |
|
397 |
updateDocid(newdocid + ".5", testdocument, SUCCESS, false); |
|
399 | 398 |
|
400 | 399 |
// but not the permissions |
401 | 400 |
testdocument = getTestEmlDoc("Testing update access block", |
... | ... | |
403 | 402 |
null, getAccessBlock(anotheruser, true, |
404 | 403 |
false, true, false, true), |
405 | 404 |
null, null, null, null); |
406 |
updateDocid(newdocid + ".5", testdocument, FAILURE, true);
|
|
405 |
updateDocid(newdocid + ".6", testdocument, FAILURE, true);
|
|
407 | 406 |
|
408 | 407 |
// try to delete the document |
409 |
//deleteDocid(newdocid + ".5", FAILURE, true);
|
|
410 |
deleteDocid(newdocid + ".4", FAILURE, true); |
|
408 |
deleteDocid(newdocid + ".5", FAILURE, true); |
|
409 |
//deleteDocid(newdocid + ".4", FAILURE, true);
|
|
411 | 410 |
|
412 | 411 |
m.logout(); |
413 | 412 |
m.login(username, password); |
... | ... | |
419 | 418 |
null, getAccessBlock(anotheruser, true, |
420 | 419 |
false, false, true, false), |
421 | 420 |
null, null, null, null); |
422 |
updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
|
|
423 |
readDocidWhichEqualsDoc(newdocid + ".5", testdocument, SUCCESS, false);
|
|
421 |
updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
|
|
422 |
readDocidWhichEqualsDoc(newdocid + ".6", testdocument, SUCCESS, false);
|
|
424 | 423 |
|
425 | 424 |
// check if the user mentioned is able to read the document |
426 | 425 |
m.logout(); |
427 | 426 |
m.login(anotheruser, anotherpassword); |
428 |
readDocidWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
|
|
427 |
readDocidWhichEqualsDoc(newdocid + ".6", testdocument, FAILURE, true);
|
|
429 | 428 |
|
430 | 429 |
// should not be able to update the document |
431 | 430 |
testdocument = getTestEmlDoc("Testing update from another user", |
... | ... | |
433 | 432 |
null, getAccessBlock(anotheruser, true, |
434 | 433 |
false, false, true, false), |
435 | 434 |
null, null, null, null); |
436 |
updateDocid(newdocid + ".6", testdocument, FAILURE, true);
|
|
435 |
updateDocid(newdocid + ".7", testdocument, FAILURE, true);
|
|
437 | 436 |
|
438 | 437 |
// but can chg the permissions |
439 | 438 |
testdocument = getTestEmlDoc("Testing update access block", |
... | ... | |
442 | 441 |
false, false, false, true), |
443 | 442 |
null, null, null, null); |
444 | 443 |
// ERRRRRRRROR |
445 |
//updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
|
|
444 |
//updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
|
|
446 | 445 |
|
447 | 446 |
// try to delete the document |
448 |
//deleteDocid(newdocid + ".6", FAILURE, true);
|
|
449 |
deleteDocid(newdocid + ".5", FAILURE, true);
|
|
447 |
//deleteDocid(newdocid + ".7", FAILURE, true);
|
|
448 |
deleteDocid(newdocid + ".6", FAILURE, true);
|
|
450 | 449 |
|
451 | 450 |
m.logout(); |
452 | 451 |
m.login(username, password); |
... | ... | |
459 | 458 |
null, getAccessBlock(anotheruser, true, |
460 | 459 |
true, true, false, false), |
461 | 460 |
null, null, null, null); |
462 |
updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
|
|
463 |
readDocidWhichEqualsDoc(newdocid + ".7", testdocument, SUCCESS, false);
|
|
461 |
updateDocid(newdocid + ".8", testdocument, SUCCESS, false);
|
|
462 |
readDocidWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
|
|
464 | 463 |
|
465 | 464 |
// check if the user mentioned is able to read the document |
466 | 465 |
m.logout(); |
467 | 466 |
m.login(anotheruser, anotherpassword); |
468 |
readDocidWhichEqualsDoc(newdocid + ".7", testdocument, SUCCESS, false);
|
|
467 |
readDocidWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
|
|
469 | 468 |
|
470 | 469 |
// should be able to update the document |
471 |
//updateDocid(newdocid + ".8", testdocument, SUCCESS, false);
|
|
470 |
updateDocid(newdocid + ".9", testdocument, SUCCESS, false);
|
|
472 | 471 |
|
473 | 472 |
// but cant chg the permissions |
474 | 473 |
testdocument = getTestEmlDoc("Testing update access block", |
... | ... | |
476 | 475 |
null, getAccessBlock(anotheruser, true, |
477 | 476 |
false, false, false, true), |
478 | 477 |
null, null, null, null); |
479 |
updateDocid(newdocid + ".9", testdocument, FAILURE, true);
|
|
478 |
updateDocid(newdocid + ".10", testdocument, FAILURE, true);
|
|
480 | 479 |
|
481 | 480 |
// try to delete the document |
482 |
// deleteDocid(newdocid + ".8", FAILURE, true); |
|
483 |
deleteDocid(newdocid + ".7", FAILURE, true); |
|
481 |
deleteDocid(newdocid + ".9", FAILURE, true); |
|
484 | 482 |
|
485 | 483 |
m.logout(); |
486 | 484 |
m.login(username, password); |
... | ... | |
493 | 491 |
null, getAccessBlock(anotheruser, true, |
494 | 492 |
true, false, true, false), |
495 | 493 |
null, null, null, null); |
496 |
updateDocid(newdocid + ".9", testdocument, SUCCESS, false);
|
|
497 |
readDocidWhichEqualsDoc(newdocid + ".9", testdocument, SUCCESS, false);
|
|
494 |
updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
|
|
495 |
readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
498 | 496 |
|
499 | 497 |
// check if the user mentioned is able to read the document |
500 | 498 |
m.logout(); |
501 | 499 |
m.login(anotheruser, anotherpassword); |
502 |
readDocidWhichEqualsDoc(newdocid + ".9", testdocument, SUCCESS, false);
|
|
500 |
readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
503 | 501 |
// should not be able to update the document |
504 | 502 |
testdocument = getTestEmlDoc("Testing update from another user", |
505 | 503 |
null, null, null, |
506 | 504 |
null, getAccessBlock(anotheruser, true, |
507 | 505 |
false, false, true, false), |
508 | 506 |
null, null, null, null); |
509 |
updateDocid(newdocid + ".10", testdocument, FAILURE, true);
|
|
507 |
updateDocid(newdocid + ".11", testdocument, FAILURE, true);
|
|
510 | 508 |
|
511 | 509 |
// but can chg the permissions |
512 | 510 |
testdocument = getTestEmlDoc("Testing update access block", |
... | ... | |
514 | 512 |
null, getAccessBlock(anotheruser, true, |
515 | 513 |
false, false, false, true), |
516 | 514 |
null, null, null, null); |
517 |
//updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
|
|
515 |
//updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
|
|
518 | 516 |
|
519 | 517 |
// try to delete the document |
520 |
// deleteDocid(newdocid + ".10", FAILURE, true);
|
|
521 |
deleteDocid(newdocid + ".9", FAILURE, true);
|
|
518 |
// deleteDocid(newdocid + ".11", FAILURE, true);
|
|
519 |
deleteDocid(newdocid + ".10", FAILURE, true);
|
|
522 | 520 |
|
523 | 521 |
m.logout(); |
524 | 522 |
m.login(username, password); |
... | ... | |
532 | 530 |
null, getAccessBlock(anotheruser, true, |
533 | 531 |
true, false, true, false), |
534 | 532 |
null, null, null, null); |
535 |
updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
|
|
536 |
readDocidWhichEqualsDoc(newdocid + ".11", testdocument, SUCCESS, false);
|
|
533 |
updateDocid(newdocid + ".12", testdocument, SUCCESS, false);
|
|
534 |
readDocidWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
|
|
537 | 535 |
|
538 | 536 |
// check if the user mentioned is able to read the document |
539 | 537 |
m.logout(); |
540 | 538 |
m.login(anotheruser, anotherpassword); |
541 |
readDocidWhichEqualsDoc(newdocid + ".11", testdocument, SUCCESS, false);
|
|
539 |
readDocidWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
|
|
542 | 540 |
|
543 | 541 |
// should not be able to update the document |
544 | 542 |
testdocument = getTestEmlDoc("Testing update from another user", |
... | ... | |
546 | 544 |
null, getAccessBlock(anotheruser, true, |
547 | 545 |
false, false, true, false), |
548 | 546 |
null, null, null, null); |
549 |
updateDocid(newdocid + ".12", testdocument, FAILURE, true);
|
|
547 |
updateDocid(newdocid + ".13", testdocument, FAILURE, true);
|
|
550 | 548 |
// but can chg the permissions |
551 | 549 |
testdocument = getTestEmlDoc("Testing update from another user", |
552 | 550 |
null, null, null, |
... | ... | |
554 | 552 |
false, false, false, true), |
555 | 553 |
null, null, null, null); |
556 | 554 |
// ERRRRRRRRRRRRRRRR |
557 |
// updateDocid(newdocid + ".12", testdocument, SUCCESS, false);
|
|
555 |
// updateDocid(newdocid + ".13", testdocument, SUCCESS, false);
|
|
558 | 556 |
|
559 | 557 |
// try to delete the document |
560 |
//deleteDocid(newdocid + ".12", FAILURE, true);
|
|
561 |
deleteDocid(newdocid + ".11", FAILURE, true);
|
|
558 |
//deleteDocid(newdocid + ".13", FAILURE, true);
|
|
559 |
deleteDocid(newdocid + ".12", FAILURE, true);
|
|
562 | 560 |
|
563 | 561 |
m.logout(); |
564 | 562 |
m.login(username, password); |
... | ... | |
571 | 569 |
null, getAccessBlock(anotheruser, true, |
572 | 570 |
true, true, true, false), |
573 | 571 |
null, null, null, null); |
574 |
updateDocid(newdocid + ".13", testdocument, SUCCESS, false);
|
|
575 |
readDocidWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
|
|
572 |
updateDocid(newdocid + ".14", testdocument, SUCCESS, false);
|
|
573 |
readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
|
|
576 | 574 |
|
577 | 575 |
// check if the user mentioned is able to read the document |
578 | 576 |
m.logout(); |
579 | 577 |
m.login(anotheruser, anotherpassword); |
580 |
readDocidWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
|
|
578 |
readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
|
|
581 | 579 |
|
582 | 580 |
// should not be able to update the document |
583 | 581 |
testdocument = getTestEmlDoc("Testing update from another user", |
... | ... | |
585 | 583 |
null, getAccessBlock(anotheruser, true, |
586 | 584 |
false, false, false, true), |
587 | 585 |
null, null, null, null); |
588 |
updateDocid(newdocid + ".14", testdocument, SUCCESS, false);
|
|
589 |
readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
|
|
586 |
updateDocid(newdocid + ".15", testdocument, SUCCESS, false);
|
|
587 |
readDocidWhichEqualsDoc(newdocid + ".15", testdocument, SUCCESS, false);
|
|
590 | 588 |
|
591 | 589 |
// but can chg the permissions |
592 | 590 |
testdocument = getTestEmlDoc("Testing update from another user", |
... | ... | |
594 | 592 |
null, getAccessBlock(anotheruser, true, |
595 | 593 |
true, false, false, false), |
596 | 594 |
null, null, null, null); |
597 |
updateDocid(newdocid + ".15", testdocument, SUCCESS, false);
|
|
598 |
readDocidWhichEqualsDoc(newdocid + ".15", testdocument, SUCCESS, false);
|
|
595 |
updateDocid(newdocid + ".16", testdocument, SUCCESS, false);
|
|
596 |
readDocidWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
|
|
599 | 597 |
|
600 | 598 |
// try to delete the document |
601 |
deleteDocid(newdocid + ".15", FAILURE, true);
|
|
599 |
deleteDocid(newdocid + ".16", FAILURE, true);
|
|
602 | 600 |
|
603 | 601 |
m.logout(); |
604 | 602 |
m.login(username, password); |
Also available in: Unified diff
Adding InlineDataAccessTest.java which has tests regarding inline data access. Also updated AccessControlTest.java