-diag('add link with rights only on base') if $ENV{'TEST_VERBOSE'};
-{
- # on q2 we have no rights, but use checking one only on thing
- local $RT::StrictLinkACL = 0;
- my $parent = RT::Ticket->new( $RT::SystemUser );
- ($id,$tid,$msg) = $parent->Create( Subject => 'Link test 1', Queue => $q2->id );
- ok($id,$msg);
- my $child = RT::Ticket->new( $creator );
- ($id,$tid,$msg) = $child->Create( Subject => 'Link test 1', Queue => $q1->id );
- ok($id,$msg);
- my ($id, $msg) = $child->AddLink(Type => 'MemberOf', Target => $parent->id);
- ok($id, $msg);
- is(link_count($filename), 1, "scrips ok");
- $child->CurrentUser( $RT::SystemUser );
- is($child->_Links('Base')->Count, 1, 'link was created');
- is($child->_Links('Target')->Count, 0, 'link was created only one');
- $child->CurrentUser( $creator );
-
- # turn off feature and try to delete link, we should fail
- $RT::StrictLinkACL = 1;
- my ($id, $msg) = $child->AddLink(Type => 'MemberOf', Target => $parent->id);
- ok(!$id, $msg);
- is(link_count($filename), 1, "scrips ok");
- $child->CurrentUser( $RT::SystemUser );
- $child->_Links('Base')->_DoCount;
- is($child->_Links('Base')->Count, 1, 'link was not deleted');
- $child->CurrentUser( $creator );
-
- # try to delete link, we should success as feature is active
- $RT::StrictLinkACL = 0;
- my ($id, $msg) = $child->DeleteLink(Type => 'MemberOf', Target => $parent->id);
- ok($id, $msg);
- is(link_count($filename), 0, "scrips ok");
- $child->CurrentUser( $RT::SystemUser );
- $child->_Links('Base')->_DoCount;
- is($child->_Links('Base')->Count, 0, 'link was deleted');
-}