[Rt-commit] rt branch, 4.4/custom-roles, repushed
Shawn Moore
shawn at bestpractical.com
Tue Oct 27 16:38:36 EDT 2015
The branch 4.4/custom-roles was deleted and repushed:
was 670ddf8b97d4a83da0ff494c52d93b5e5fe1103f
now 1a8e3a17877b5bbbbf86c68cade97267b43cc0a7
1: 3da168a = 1: 3da168a Tidy EmailInput and avoid including unescaped parameters
2: f4a3966 = 2: f4a3966 Placeholder and EntryHint for EmailInput
3: 5b777ea = 3: 5b777ea Support autocomplete-return for EmailInput
4: 1168416 = 4: 1168416 Support for (by default, off) autocomplete of Nobody and System
5: 87d20c2 = 5: 87d20c2 Only include one copy of "check box to delete" for queue watchers
6: 7c59fae = 6: 7c59fae Simplify IsManageableRoleGroupType
7: 78cbe3d = 7: 78cbe3d Switch several hardcoded lists to use ->Roles
8: 8b8897b = 8: 8b8897b Avoid empty results and undef warnings in bulk update
9: 89d776e = 9: 89d776e Tidy AddWatchers
10: accaf5b = 10: accaf5b Use the record we have for inspecting roles, rather than class RT::Queue
11: 3d5ba26 = 11: 3d5ba26 Add a CheckRight param to ->RoleGroup
12: f467d55 = 12: f467d55 Fix one-off "Administrative Cc" with "AdminCc"
13: 1c0c7d0 ! 13: 7cb01e5 Provide queue to EditBasics for new tickets (they don't have a ->QueueObj)
@@ -1,6 +1,6 @@
Author: Shawn M Moore <shawn at bestpractical.com>
- Provide queue to EditBasics for new tickets that don't have a ->QueueObj
+ Provide queue to EditBasics for new tickets (they don't have a ->QueueObj)
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
--- a/share/html/Ticket/Create.html
14: 4caef7d = 14: 71fc832 Provide defaults to EditBasics for "Add More Attach" etc
15: a31d308 = 15: 4b1fd93 Factor out a CanonicalizePrincipal from AddRoleMember
16: 60c36e3 = 16: c7759ba Consistent error message across AddRoleMember and DeleteRoleMember
17: 5a4f796 = 17: ff898d8 Factor out a _CreateRoleGroup
18: 56ba03b = 18: 6f0d646 Lazily create ticket role groups if needed
19: adb0fa2 = 19: b2d8700 Use queue to resolve roles on create since the ticket isn't created yet
20: 6b9319e = 20: fe79a2f Process watcher updates from ticket Modify
21: 0fe95ea = 21: eccef99 Improve messaging around updating queue/ticket watchers
22: 7f30e06 = 22: 4a6331d Additional option for roles
23: 67d5005 = 23: f7be7cd Tidy watcher searching in RT::Tickets
24: 708ac1e = 24: dbea774 Improve comments around GetPrincipalsMap
--: ------- > 25: a08feeb Add Ticket->RoleAddresses($Name)
25: a96e16e = 26: a6cd627 Add a Group->Label hook for when we display a group's name in the UI
26: 826cbba = 27: 01dc0ac Switch to ->LabelForRole
27: c9059b7 ! 28: e7b0433 Add custom roles for queues
@@ -699,7 +699,7 @@
+ my $temp = RT::CustomRole->new(RT->SystemUser);
+ $temp->LoadByCols(Name => $name);
+
-+ if ( $temp->Name && $temp->id != $self->id) {
++ if ( $temp->Name && $temp->id != ($self->id||0)) {
+ return (undef, $self->loc("Role already exists") );
+ }
+
@@ -2914,3 +2914,452 @@
comp => '/Elements/EditTimeValue',
args => {
+diff --git a/t/customroles/basic.t b/t/customroles/basic.t
+new file mode 100644
+--- /dev/null
++++ b/t/customroles/basic.t
+@@
++use strict;
++use warnings;
++
++use RT::Test tests => undef;
++
++my $general = RT::Test->load_or_create_queue( Name => 'General' );
++my $inbox = RT::Test->load_or_create_queue( Name => 'Inbox' );
++my $specs = RT::Test->load_or_create_queue( Name => 'Specs' );
++my $development = RT::Test->load_or_create_queue( Name => 'Development' );
++
++diag 'testing no roles yet' if $ENV{'TEST_VERBOSE'};
++{
++ my $roles = RT::CustomRoles->new(RT->SystemUser);
++ $roles->UnLimit;
++ is($roles->Count, 0, 'no roles created yet');
++
++ is_deeply([sort RT::System->Roles], ['AdminCc', 'Cc', 'Owner', 'Requestor'], 'System->Roles');
++ is_deeply([sort RT::Queue->Roles], ['AdminCc', 'Cc', 'Owner', 'Requestor'], 'Queue->Roles');
++ is_deeply([sort $general->Roles], ['AdminCc', 'Cc', 'Owner', 'Requestor'], 'General->Roles');
++ is_deeply([sort RT::Ticket->Roles], ['AdminCc', 'Cc', 'Owner', 'Requestor'], 'Ticket->Roles');
++ is_deeply([sort RT::Queue->ManageableRoleGroupTypes], ['AdminCc', 'Cc'], 'Queue->ManageableRoleTypes');
++ is_deeply([sort $general->ManageableRoleGroupTypes], ['AdminCc', 'Cc'], 'General->ManageableRoleTypes');
++}
++
++diag 'create a single-member role' if $ENV{'TEST_VERBOSE'};
++my $engineer;
++{
++ $engineer = RT::CustomRole->new(RT->SystemUser);
++ my ($ok, $msg) = $engineer->Create(
++ Name => 'Engineer-' . $$,
++ MaxValues => 1,
++ );
++ ok($ok, "created role: $msg");
++
++ is($engineer->Name, 'Engineer-' . $$, 'role name');
++ is($engineer->MaxValues, 1, 'role is single member');
++ ok($engineer->SingleValue, 'role is single member');
++ ok(!$engineer->UnlimitedValues, 'role is single member');
++ ok(!$engineer->IsAddedToAny, 'role is not applied to any queues yet');
++ ok(RT::Queue->Role('RT::CustomRole-1')->{Single}, 'role is single member');
++
++ is_deeply([sort RT::System->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'Requestor'], 'System->Roles');
++ is_deeply([sort RT::Queue->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'Requestor'], 'Queue->Roles');
++ is_deeply([sort $general->Roles], ['AdminCc', 'Cc', 'Owner', 'Requestor'], 'General->Roles');
++ is_deeply([sort RT::Ticket->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'Requestor'], 'Ticket->Roles');
++ is_deeply([sort RT::Queue->ManageableRoleGroupTypes], ['AdminCc', 'Cc'], 'Queue->ManageableRoleTypes');
++ is_deeply([sort $general->ManageableRoleGroupTypes], ['AdminCc', 'Cc'], 'General->ManageableRoleTypes');
++}
++
++diag 'create a multi-member role' if $ENV{'TEST_VERBOSE'};
++my $sales;
++{
++ $sales = RT::CustomRole->new(RT->SystemUser);
++ my ($ok, $msg) = $sales->Create(
++ Name => 'Sales-' . $$,
++ MaxValues => 0,
++ );
++ ok($ok, "created role: $msg");
++
++ is($sales->Name, 'Sales-' . $$, 'role name');
++ is($sales->MaxValues, 0, 'role is multi member');
++ ok(!$sales->SingleValue, 'role is multi member');
++ ok($sales->UnlimitedValues, 'role is multi member');
++ ok(!$sales->IsAddedToAny, 'role is not applied to any queues yet');
++ ok(!RT::Queue->Role('RT::CustomRole-2')->{Single}, 'role is multi member');
++
++ is_deeply([sort RT::System->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor'], 'System->Roles');
++ is_deeply([sort RT::Queue->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor'], 'Queue->Roles');
++ is_deeply([sort $general->Roles], ['AdminCc', 'Cc', 'Owner', 'Requestor'], 'General->Roles');
++ is_deeply([sort RT::Ticket->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor'], 'Ticket->Roles');
++ is_deeply([sort RT::Queue->ManageableRoleGroupTypes], ['AdminCc', 'Cc', 'RT::CustomRole-2'], 'Queue->ManageableRoleTypes');
++ is_deeply([sort $general->ManageableRoleGroupTypes], ['AdminCc', 'Cc'], 'General->ManageableRoleTypes');
++}
++
++diag 'collection methods' if $ENV{'TEST_VERBOSE'};
++{
++ my $roles = RT::CustomRoles->new(RT->SystemUser);
++ $roles->UnLimit;
++ $roles->OrderBy(
++ FIELD => 'id',
++ ORDER => 'Asc',
++ );
++
++ is($roles->Count, 2, 'two roles');
++ is($roles->Next->Name, 'Engineer-' . $$, 'first role');
++ is($roles->Next->Name, 'Sales-' . $$, 'second role');
++
++ my $single = RT::CustomRoles->new(RT->SystemUser);
++ $single->LimitToSingleValue;
++ is($single->Count, 1, 'one single-value role');
++ is($single->Next->Name, 'Engineer-' . $$, 'single role');
++
++ my $multi = RT::CustomRoles->new(RT->SystemUser);
++ $multi->LimitToMultipleValue;
++ is($multi->Count, 1, 'one multi-value role');
++ is($multi->Next->Name, 'Sales-' . $$, 'single role');
++}
++
++diag 'roles not added to any queues yet' if $ENV{'TEST_VERBOSE'};
++{
++ for my $queue ($general, $inbox, $specs, $development) {
++ my $roles = RT::CustomRoles->new(RT->SystemUser);
++ $roles->LimitToObjectId($queue->Id);
++ is($roles->Count, 0, 'no roles yet for ' . $queue->Name);
++
++ my $qroles = $queue->CustomRoles;
++ is($qroles->Count, 0, 'no roles yet from ' . $queue->Name);
++
++ ok(!$sales->IsAdded($queue->Id), 'Sales is not added to ' . $queue->Name);
++ ok(!$engineer->IsAdded($queue->Id), 'Engineer is not added to ' . $queue->Name);
++ }
++}
++
++diag 'add roles to queues' if $ENV{'TEST_VERBOSE'};
++{
++ my ($ok, $msg) = $sales->AddToObject($inbox->id);
++ ok($ok, "added Sales to Inbox: $msg");
++
++ ($ok, $msg) = $sales->AddToObject($specs->id);
++ ok($ok, "added Sales to Specs: $msg");
++
++ ($ok, $msg) = $engineer->AddToObject($specs->id);
++ ok($ok, "added Engineer to Specs: $msg");
++
++ ($ok, $msg) = $engineer->AddToObject($development->id);
++ ok($ok, "added Engineer to Development: $msg");
++}
++
++diag 'roles now added to queues' if $ENV{'TEST_VERBOSE'};
++{
++ is_deeply([sort RT::System->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor'], 'System->Roles');
++ is_deeply([sort RT::Queue->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor'], 'Queue->Roles');
++ is_deeply([sort RT::Ticket->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor'], 'Ticket->Roles');
++ is_deeply([sort RT::Queue->ManageableRoleGroupTypes], ['AdminCc', 'Cc', 'RT::CustomRole-2'], 'Queue->ManageableRoleTypes');
++
++ # General
++ {
++ my $roles = RT::CustomRoles->new(RT->SystemUser);
++ $roles->LimitToObjectId($general->Id);
++ is($roles->Count, 0, 'no roles for General');
++
++ my $qroles = $general->CustomRoles;
++ is($qroles->Count, 0, 'no roles from General');
++
++ ok(!$sales->IsAdded($general->Id), 'Sales is not added to General');
++ ok(!$engineer->IsAdded($general->Id), 'Engineer is not added to General');
++
++ is_deeply([sort $general->Roles], ['AdminCc', 'Cc', 'Owner', 'Requestor'], 'General->Roles');
++ is_deeply([sort $general->ManageableRoleGroupTypes], ['AdminCc', 'Cc'], 'General->ManageableRoleTypes');
++ is_deeply([grep { $general->IsManageableRoleGroupType($_) } 'AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor', 'Nonexistent'], ['AdminCc', 'Cc'], 'General IsManageableRoleGroupType');
++ }
++
++ # Inbox
++ {
++ my $roles = RT::CustomRoles->new(RT->SystemUser);
++ $roles->LimitToObjectId($inbox->Id);
++ is($roles->Count, 1, 'one role for Inbox');
++ is($roles->Next->Name, 'Sales-' . $$, 'and the one role is Sales');
++
++ my $qroles = $inbox->CustomRoles;
++ is($qroles->Count, 1, 'one role from Inbox');
++ is($qroles->Next->Name, 'Sales-' . $$, 'and the one role is Sales');
++
++ ok($sales->IsAdded($inbox->Id), 'Sales is added to Inbox');
++ ok(!$engineer->IsAdded($inbox->Id), 'Engineer is not added to Inbox');
++
++ is_deeply([sort $inbox->Roles], ['AdminCc', 'Cc', 'Owner', $sales->GroupType, 'Requestor'], 'Inbox->Roles');
++ is_deeply([sort $inbox->ManageableRoleGroupTypes], ['AdminCc', 'Cc', $sales->GroupType], 'Inbox->ManageableRoleTypes');
++ is_deeply([grep { $inbox->IsManageableRoleGroupType($_) } 'AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor', 'Nonexistent'], ['AdminCc', 'Cc', 'RT::CustomRole-2'], 'Inbox IsManageableRoleGroupType');
++ }
++
++ # Specs
++ {
++ my $roles = RT::CustomRoles->new(RT->SystemUser);
++ $roles->LimitToObjectId($specs->Id);
++ $roles->OrderBy(
++ FIELD => 'id',
++ ORDER => 'Asc',
++ );
++ is($roles->Count, 2, 'two roles for Specs');
++ is($roles->Next->Name, 'Engineer-' . $$, 'and the first role is Engineer');
++ is($roles->Next->Name, 'Sales-' . $$, 'and the second role is Sales');
++
++ my $qroles = $specs->CustomRoles;
++ $qroles->OrderBy(
++ FIELD => 'id',
++ ORDER => 'Asc',
++ );
++ is($qroles->Count, 2, 'two roles from Specs');
++ is($qroles->Next->Name, 'Engineer-' . $$, 'and the first role is Engineer');
++ is($qroles->Next->Name, 'Sales-' . $$, 'and the second role is Sales');
++
++ ok($sales->IsAdded($specs->Id), 'Sales is added to Specs');
++ ok($engineer->IsAdded($specs->Id), 'Engineer is added to Specs');
++
++ is_deeply([sort $specs->Roles], ['AdminCc', 'Cc', 'Owner', $engineer->GroupType, $sales->GroupType, 'Requestor'], 'Specs->Roles');
++ is_deeply([sort $specs->ManageableRoleGroupTypes], ['AdminCc', 'Cc', $sales->GroupType], 'Specs->ManageableRoleTypes');
++ is_deeply([grep { $specs->IsManageableRoleGroupType($_) } 'AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor', 'Nonexistent'], ['AdminCc', 'Cc', 'RT::CustomRole-2'], 'Specs IsManageableRoleGroupType');
++ }
++
++ # Development
++ {
++ my $roles = RT::CustomRoles->new(RT->SystemUser);
++ $roles->LimitToObjectId($development->Id);
++ is($roles->Count, 1, 'one role for Development');
++ is($roles->Next->Name, 'Engineer-' . $$, 'and the one role is sales');
++
++ my $qroles = $development->CustomRoles;
++ is($qroles->Count, 1, 'one role from Development');
++ is($qroles->Next->Name, 'Engineer-' . $$, 'and the one role is sales');
++
++ ok(!$sales->IsAdded($development->Id), 'Sales is not added to Development');
++ ok($engineer->IsAdded($development->Id), 'Engineer is added to Development');
++
++ is_deeply([sort $development->Roles], ['AdminCc', 'Cc', 'Owner', $engineer->GroupType, 'Requestor'], 'Development->Roles');
++ is_deeply([sort $development->ManageableRoleGroupTypes], ['AdminCc', 'Cc'], 'Development->ManageableRoleTypes');
++ is_deeply([grep { $development->IsManageableRoleGroupType($_) } 'AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'Requestor', 'Nonexistent'], ['AdminCc', 'Cc'], 'Development IsManageableRoleGroupType');
++ }
++}
++
++diag 'role names' if $ENV{'TEST_VERBOSE'};
++{
++ my ($ok, $msg) = $engineer->SetName('Programmer-' . $$);
++ ok($ok, "SetName: $msg");
++ is($engineer->Name, 'Programmer-' . $$, 'new name');
++
++ # should be okay
++ ($ok, $msg) = $engineer->SetName('Programmer-' . $$);
++ ok($ok || $msg =~ /already the current value/ , "SetName: $msg");
++ is($engineer->Name, 'Programmer-' . $$, 'new name');
++
++ my $playground = RT::CustomRole->new(RT->SystemUser);
++ ($ok, $msg) = $playground->Create(Name => 'Playground-' . $$, MaxValues => 1);
++ ok($ok, "playground role: $msg");
++
++ for my $name (
++ 'Programmer-' . $$,
++ 'proGRAMMER-' . $$,
++ 'Cc',
++ 'CC',
++ 'AdminCc',
++ 'ADMIN CC',
++ 'Requestor',
++ 'requestors',
++ 'Owner',
++ 'OWNer',
++ ) {
++ # creating a role with that name should fail
++ my $new = RT::CustomRole->new(RT->SystemUser);
++ ($ok, $msg) = $new->Create(Name => $name, MaxValues => 1);
++ ok(!$ok, "creating a role with duplicate name $name should fail: $msg");
++
++ # updating an existing role with the dupe name should fail too
++ ($ok, $msg) = $playground->SetName($name);
++ ok(!$ok, "updating an existing role with duplicate name $name should fail: $msg");
++ is($playground->Name, 'Playground-' . $$, 'name stayed the same');
++ }
++
++ # make sure we didn't create any new roles
++ my $roles = RT::CustomRoles->new(RT->SystemUser);
++ $roles->UnLimit;
++ is($roles->Count, 3, 'three roles (original two plus playground)');
++
++ is_deeply([sort RT::System->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'RT::CustomRole-3', 'Requestor'], 'No new System->Roles');
++ is_deeply([sort RT::Queue->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'RT::CustomRole-3', 'Requestor'], 'No new Queue->Roles');
++ is_deeply([sort RT::Ticket->Roles], ['AdminCc', 'Cc', 'Owner', 'RT::CustomRole-1', 'RT::CustomRole-2', 'RT::CustomRole-3', 'Requestor'], 'No new Ticket->Roles');
++ is_deeply([sort RT::Queue->ManageableRoleGroupTypes], ['AdminCc', 'Cc', 'RT::CustomRole-2'], 'No new Queue->ManageableRoleGroupTypes');
++}
++
++diag 'load by name and id' if $ENV{'TEST_VERBOSE'};
++{
++ my $role = RT::CustomRole->new(RT->SystemUser);
++ $role->Load($engineer->id);
++ is($role->Name, 'Programmer-' . $$, 'load by id');
++
++ $role = RT::CustomRole->new(RT->SystemUser);
++ $role->Load('Sales-' . $$);
++ is($role->id, $sales->id, 'load by name');
++}
++
++diag 'LabelForRole' if $ENV{'TEST_VERBOSE'};
++{
++ is($inbox->LabelForRole($sales->GroupType), 'Sales-' . $$, 'Inbox label for Sales');
++ is($specs->LabelForRole($sales->GroupType), 'Sales-' . $$, 'Specs label for Sales');
++ is($specs->LabelForRole($engineer->GroupType), 'Programmer-' . $$, 'Specs label for Engineer');
++ is($development->LabelForRole($engineer->GroupType), 'Programmer-' . $$, 'Development label for Engineer');
++}
++
++done_testing;
+
+diff --git a/t/customroles/tickets.t b/t/customroles/tickets.t
+new file mode 100644
+--- /dev/null
++++ b/t/customroles/tickets.t
+@@
++use strict;
++use warnings;
++
++use RT::Test tests => undef;
++
++my $general = RT::Test->load_or_create_queue( Name => 'General' );
++my $inbox = RT::Test->load_or_create_queue( Name => 'Inbox' );
++my $specs = RT::Test->load_or_create_queue( Name => 'Specs' );
++my $development = RT::Test->load_or_create_queue( Name => 'Development' );
++
++my $engineer = RT::CustomRole->new(RT->SystemUser);
++my $sales = RT::CustomRole->new(RT->SystemUser);
++my $unapplied = RT::CustomRole->new(RT->SystemUser);
++
++my $linus = RT::Test->load_or_create_user( EmailAddress => 'linus at example.com' );
++my $blake = RT::Test->load_or_create_user( EmailAddress => 'blake at example.com' );
++my $williamson = RT::Test->load_or_create_user( EmailAddress => 'williamson at example.com' );
++my $moss = RT::Test->load_or_create_user( EmailAddress => 'moss at example.com' );
++my $ricky = RT::Test->load_or_create_user( EmailAddress => 'ricky.roma at example.com' );
++
++
++diag 'setup' if $ENV{'TEST_VERBOSE'};
++{
++ ok( RT::Test->add_rights( { Principal => 'Privileged', Right => [ qw(CreateTicket ShowTicket ModifyTicket OwnTicket SeeQueue) ] } ));
++
++ my ($ok, $msg) = $engineer->Create(
++ Name => 'Engineer-' . $$,
++ MaxValues => 1,
++ );
++ ok($ok, "created Engineer role: $msg");
++
++ ($ok, $msg) = $sales->Create(
++ Name => 'Sales-' . $$,
++ MaxValues => 0,
++ );
++ ok($ok, "created Sales role: $msg");
++
++ ($ok, $msg) = $unapplied->Create(
++ Name => 'Unapplied-' . $$,
++ MaxValues => 0,
++ );
++ ok($ok, "created Unapplied role: $msg");
++
++ ($ok, $msg) = $sales->AddToObject($inbox->id);
++ ok($ok, "added Sales to Inbox: $msg");
++
++ ($ok, $msg) = $sales->AddToObject($specs->id);
++ ok($ok, "added Sales to Specs: $msg");
++
++ ($ok, $msg) = $engineer->AddToObject($specs->id);
++ ok($ok, "added Engineer to Specs: $msg");
++
++ ($ok, $msg) = $engineer->AddToObject($development->id);
++ ok($ok, "added Engineer to Development: $msg");
++}
++
++diag 'create tickets in General (no custom roles)' if $ENV{'TEST_VERBOSE'};
++{
++ my $general1 = RT::Test->create_ticket(
++ Queue => $general,
++ Subject => 'a ticket',
++ Owner => $williamson,
++ Requestor => [$blake->EmailAddress],
++ );
++ is($general1->OwnerObj->id, $williamson->id, 'owner is correct');
++ is($general1->RequestorAddresses, $blake->EmailAddress, 'requestors correct');
++ is($general1->CcAddresses, '', 'no ccs');
++ is($general1->AdminCcAddresses, '', 'no adminccs');
++ is($general1->RoleAddresses($engineer->GroupType), '', 'no engineer (role not applied to queue)');
++ is($general1->RoleAddresses($sales->GroupType), '', 'no sales (role not applied to queue)');
++
++ my $general2 = RT::Test->create_ticket(
++ Queue => $general,
++ Subject => 'another ticket',
++ Owner => $linus,
++ Requestor => [$moss->EmailAddress, $williamson->EmailAddress],
++ Cc => [$ricky->EmailAddress],
++ AdminCc => [$blake->EmailAddress],
++ );
++ is($general2->OwnerObj->id, $linus->id, 'owner is correct');
++ is($general2->RequestorAddresses, (join ', ', $moss->EmailAddress, $williamson->EmailAddress), 'requestors correct');
++ is($general2->CcAddresses, $ricky->EmailAddress, 'cc correct');
++ is($general2->AdminCcAddresses, $blake->EmailAddress, 'admincc correct');
++ is($general2->RoleAddresses($engineer->GroupType), '', 'no engineer (role not applied to queue)');
++ is($general2->RoleAddresses($sales->GroupType), '', 'no sales (role not applied to queue)');
++
++ my $general3 = RT::Test->create_ticket(
++ Queue => $general,
++ Subject => 'oops',
++ Owner => $ricky,
++ $engineer->GroupType => $linus,
++ $sales->GroupType => [$blake->EmailAddress],
++ );
++ is($general3->OwnerObj->id, $ricky->id, 'owner is correct');
++ is($general3->RequestorAddresses, '', 'no requestors');
++ is($general3->CcAddresses, '', 'no cc');
++ is($general3->AdminCcAddresses, '', 'no admincc');
++ is($general3->RoleAddresses($engineer->GroupType), '', 'no engineer (role not applied to queue)');
++ is($general3->RoleAddresses($sales->GroupType), '', 'no sales (role not applied to queue)');
++}
++
++diag 'create tickets in Inbox (sales role)' if $ENV{'TEST_VERBOSE'};
++{
++ my $inbox1 = RT::Test->create_ticket(
++ Queue => $inbox,
++ Subject => 'a ticket',
++ Owner => $williamson,
++ Requestor => [$blake->EmailAddress],
++ );
++ is($inbox1->OwnerObj->id, $williamson->id, 'owner is correct');
++ is($inbox1->RequestorAddresses, $blake->EmailAddress, 'requestors correct');
++ is($inbox1->CcAddresses, '', 'no ccs');
++ is($inbox1->AdminCcAddresses, '', 'no adminccs');
++ is($inbox1->RoleAddresses($engineer->GroupType), '', 'no engineer (role not applied to queue)');
++ is($inbox1->RoleAddresses($sales->GroupType), '', 'no sales (role not applied to queue)');
++
++ my $inbox2 = RT::Test->create_ticket(
++ Queue => $inbox,
++ Subject => 'another ticket',
++ Owner => $linus,
++ Requestor => [$moss->EmailAddress, $williamson->EmailAddress],
++ Cc => [$ricky->EmailAddress],
++ AdminCc => [$blake->EmailAddress],
++ );
++ is($inbox2->OwnerObj->id, $linus->id, 'owner is correct');
++ is($inbox2->RequestorAddresses, (join ', ', $moss->EmailAddress, $williamson->EmailAddress), 'requestors correct');
++ is($inbox2->CcAddresses, $ricky->EmailAddress, 'cc correct');
++ is($inbox2->AdminCcAddresses, $blake->EmailAddress, 'admincc correct');
++ is($inbox2->RoleAddresses($engineer->GroupType), '', 'no engineer (role not applied to queue)');
++ is($inbox2->RoleAddresses($sales->GroupType), '', 'no sales (role not applied to queue)');
++
++ my $inbox3 = RT::Test->create_ticket(
++ Queue => $inbox,
++ Subject => 'oops',
++ Owner => $ricky,
++ $engineer->GroupType => $linus,
++ $sales->GroupType => [$blake->EmailAddress],
++ );
++ is($inbox3->OwnerObj->id, $ricky->id, 'owner is correct');
++ is($inbox3->RequestorAddresses, '', 'no requestors');
++ is($inbox3->CcAddresses, '', 'no cc');
++ is($inbox3->AdminCcAddresses, '', 'no admincc');
++ is($inbox3->RoleAddresses($engineer->GroupType), '', 'no engineer (role not applied to queue)');
++ is($inbox3->RoleAddresses($sales->GroupType), $blake->EmailAddress, 'got sales');
++}
++
++done_testing;
++
+
28: 307dc74 = 29: 5a924ad @CustomRoles in initialdata, support CustomRole in @ACL
29: 4d3a340 = 30: 8be477a Add custom roles to search builder
30: 670ddf8 = 31: 1a8e3a1 Ensure custom role name uniqueness in rt-validator
More information about the rt-commit
mailing list