[Rt-commit] [rtir] 01/01: grant DutyTeam ForwardMessage right
? sunnavy
sunnavy at bestpractical.com
Wed Oct 14 13:19:32 EDT 2015
This is an automated email from the git hooks/post-receive script.
sunnavy pushed a commit to branch 3.4/forward-message-right
in repository rtir.
commit dd58e3c4e011f5640f8d436c6dd90841c120dfea
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Oct 15 01:03:19 2015 +0800
grant DutyTeam ForwardMessage right
Fixes: I#30481
---
docs/UPGRADING-3.4 | 4 ++++
etc/upgrade/3.3.3/content | 34 ++++++++++++++++++++++++++++++++++
lib/RT/IR.pm | 1 +
3 files changed, 39 insertions(+)
diff --git a/docs/UPGRADING-3.4 b/docs/UPGRADING-3.4
index 70161ed..fa8a14d 100644
--- a/docs/UPGRADING-3.4
+++ b/docs/UPGRADING-3.4
@@ -62,4 +62,8 @@ the C<X-RT-Mail-Extension> message header. As RTIR now supports
the features of 'regular' RT queues for constituencies, using
message headers to set RTIR constituencies is no longer available.
+=head2 Rights
+=head3 ForwardMessage
+
+DutyTeams now have C<ForwardMessage> right by default.
diff --git a/etc/upgrade/3.3.3/content b/etc/upgrade/3.3.3/content
new file mode 100644
index 0000000..0e1513d
--- /dev/null
+++ b/etc/upgrade/3.3.3/content
@@ -0,0 +1,34 @@
+use strict;
+use warnings;
+
+our @Initial = (
+ sub {
+ my $cf = RT::CustomField->new(RT->SystemUser);
+ $cf->Load( "RTIR Constituency", LookupType => 'RT::Queue' );
+ my @constituencies = ('', map { $_->Name } @{$cf->Values->ItemsArrayRef || []} );
+
+ my %groups;
+ for my $constituency ( @constituencies ) {
+ my $group = RT::Group->new(RT->SystemUser);
+ $group->LoadUserDefinedGroup('DutyTeam' . ($constituency ? " $constituency" : '') );
+ $groups{$constituency} = $group if $group->id;
+ }
+ my $queues = RT::Queues->new(RT->SystemUser);
+ $queues->UnLimit;
+ while ( my $queue = $queues->Next ) {
+ my $constituency = $queue->FirstCustomFieldValue('RTIR Constituency');
+ if ( $constituency || $queue->Name =~ /^(?:Incidents|Incident Reports|Investigations|Blocks)$/ ) {
+ my $group = $groups{$constituency || ''};
+ if ( $group && !$group->PrincipalObj->HasRight( Right => 'ForwardMessage', Object => $queue ) ) {
+ my ( $ret, $msg ) = $group->PrincipalObj->GrantRight(
+ Right => 'ForwardMessage',
+ Object => $queue,
+ );
+ unless ($ret) {
+ RT->Logger->error("Couldn't grant ForwardMessage to DutyTeam of queue #" . $queue->id . ": $msg");
+ }
+ }
+ }
+ }
+ },
+);
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 795a384..002ea1c 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -105,6 +105,7 @@ sub DutyTeamAllQueueRights {
TakeTicket
Watch
ShowOutgoingEmail
+ ForwardMessage
));
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list