diff options
author | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
---|---|---|
committer | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
commit | c82d349f864e6bd9f96fd1156903bc1f7193a203 (patch) | |
tree | e117a87533656110b6acd56fc0ca64289892a9f5 /rt/t/web/rights.t | |
parent | 74e058c8a010ef6feb539248a550d0bb169c1e94 (diff) |
This commit was manufactured by cvs2svn to create tag 'TORRUS_1_0_9'.TORRUS_1_0_9
Diffstat (limited to 'rt/t/web/rights.t')
-rw-r--r-- | rt/t/web/rights.t | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/rt/t/web/rights.t b/rt/t/web/rights.t deleted file mode 100644 index b47ba99af..000000000 --- a/rt/t/web/rights.t +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/perl -w -use strict; -use warnings; - -use RT::Test tests => 14; - -my ($baseurl, $m) = RT::Test->started_ok; -ok $m->login, "logged in"; - -$m->follow_link_ok({ text => 'Configuration' }); -$m->follow_link_ok({ text => 'Global' }); -$m->follow_link_ok({ text => 'Group Rights' }); - - -sub get_rights { - my $agent = shift; - my $principal_id = shift; - my $object = shift; - $agent->form_number(3); - my @inputs = $agent->current_form->find_input("RevokeRight-$principal_id-$object"); - my @rights = sort grep $_, map $_->possible_values, grep $_, @inputs; - return @rights; -}; - -diag "load Everyone group" if $ENV{'TEST_VERBOSE'}; -my ($everyone, $everyone_gid); -{ - $everyone = RT::Group->new( $RT::SystemUser ); - $everyone->LoadSystemInternalGroup('Everyone'); - ok($everyone_gid = $everyone->id, "loaded 'everyone' group"); -} - -diag "revoke all global rights from Everyone group" if $ENV{'TEST_VERBOSE'}; -my @has = get_rights( $m, $everyone_gid, 'RT::System-1' ); -if ( @has ) { - $m->form_number(3); - $m->tick("RevokeRight-$everyone_gid-RT::System-1", $_) foreach @has; - $m->submit; - - is_deeply([get_rights( $m, $everyone_gid, 'RT::System-1' )], [], 'deleted all rights' ); -} else { - ok(1, 'the group has no global rights'); -} - -diag "grant SuperUser right to everyone" if $ENV{'TEST_VERBOSE'}; -{ - $m->form_number(3); - $m->select("GrantRight-$everyone_gid-RT::System-1", ['SuperUser']); - $m->submit; - - $m->content_contains('Right Granted', 'got message'); - RT::Principal::InvalidateACLCache(); - ok($everyone->PrincipalObj->HasRight( Right => 'SuperUser', Object => $RT::System ), 'group has right'); - is_deeply( [get_rights( $m, $everyone_gid, 'RT::System-1' )], ['SuperUser'], 'granted SuperUser right' ); -} - -diag "revoke the right" if $ENV{'TEST_VERBOSE'}; -{ - $m->form_number(3); - $m->tick("RevokeRight-$everyone_gid-RT::System-1", 'SuperUser'); - $m->submit; - - $m->content_contains('Right revoked', 'got message'); - RT::Principal::InvalidateACLCache(); - ok(!$everyone->PrincipalObj->HasRight( Right => 'SuperUser', Object => $RT::System ), 'group has no right'); - is_deeply( [get_rights( $m, $everyone_gid, 'RT::System-1' )], [], 'revoked SuperUser right' ); -} - - -diag "return rights the group had in the beginning" if $ENV{'TEST_VERBOSE'}; -if ( @has ) { - $m->form_number(3); - $m->select("GrantRight-$everyone_gid-RT::System-1", \@has); - $m->submit; - - $m->content_contains('Right Granted', 'got message'); - is_deeply( - [ get_rights( $m, $everyone_gid, 'RT::System-1' ) ], - [ @has ], - 'returned back all rights' - ); -} else { - ok(1, 'the group had no global rights, so nothing to return'); -} - |