1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
use strict;
use warnings;
use RT::Test tests => 11;
RT->Config->Set( ShowMoreAboutPrivilegedUsers => 1 );
my ( $url, $m ) = RT::Test->started_ok;
my $user_a = RT::Test->load_or_create_user(
Name => 'user_a',
Password => 'password',
);
ok( $user_a, 'created user user_a' );
ok(
RT::Test->set_rights(
{
Principal => $user_a,
Right => [ qw/SeeQueue ShowTicket CreateTicket/ ]
},
),
'set rights for user_a'
);
my $ticket = RT::Ticket->new(RT->SystemUser);
my ($id) = $ticket->Create(
Subject => 'groups limit',
Queue => 'General',
Requestor => $user_a->id,
);
ok( $id, 'created ticket' );
my $url_regex = qr{\/Admin\/Users\/Memberships\.html};
ok( $m->login( user_a => 'password' ), 'logged in as user_a' );
$m->goto_ticket($id);
ok(
!$m->find_link( url_regex => $url_regex ), 'no Edit link without AdminUsers permission'
);
ok(
RT::Test->add_rights(
{
Principal => $user_a,
Right => [ qw/AdminUsers ShowConfigTab/ ]
},
),
'add AdminUsers and ShowConfigTab rights for user_a'
);
$m->goto_ticket($id);
$m->follow_link_ok( { url_regex => $url_regex }, 'follow the Edit link' );
is( $m->uri, $url . "/Admin/Users/Memberships.html?id=" . $user_a->id, 'url is right' );
|