cleaned and improved monitor-rt3.init
[monitor.git] / rt3 / initialdata
1 # Initial data for a fresh RT3 Installation.
2
3 @Users = (
4     {  Name     => 'Nobody',
5        RealName => 'Nobody in particular',
6        Comments => 'Do not delete or modify this user. It is integral '
7          . 'to RT\'s internal data structures',
8        Privileged => '0', },
9
10     {  Name         => 'root',
11        Gecos        => 'root',
12        RealName     => 'Enoch Root',
13        Password     => 'password',
14        EmailAddress => "root\@localhost",
15        Comments     => 'SuperUser',
16        Privileged   => '1', } );
17
18 @Groups = (
19     { Name        => '',
20       Type        => 'Everyone',                        # loc
21       Domain      => 'SystemInternal',
22       Instance    => '',
23       Description => 'Pseudogroup for internal use',    # loc
24     },
25     { Type        => 'Privileged',                      # loc
26       Domain      => 'SystemInternal',
27       Instance    => '',
28       Name        => '',
29       Description => 'Pseudogroup for internal use',    # loc
30     },
31     { Name        => '',
32       Type        => 'Unprivileged',                    # loc
33       Domain      => 'SystemInternal',
34       Instance    => '',
35       Description => 'Pseudogroup for internal use',    # loc
36     },
37     { Name        => '',
38       Type        => 'Owner',                               # loc
39       Domain      => 'RT::System-Role',
40       Instance    => '',
41       Description => 'SystemRolegroup for internal use',    # loc
42     },
43     { Name        => '',
44       Type        => 'Requestor',                           # loc
45       Domain      => 'RT::System-Role',
46       Instance    => '',
47       Description => 'SystemRolegroup for internal use',    # loc
48     },
49     { Name        => '',
50       Type        => 'Cc',                                  # loc
51       Domain      => 'RT::System-Role',
52       Instance    => '',
53       Description => 'SystemRolegroup for internal use',    # loc
54     },
55     { Name        => '',
56       Type        => 'AdminCc',                             # loc
57       Domain      => 'RT::System-Role',
58       Instance    => '',
59       Description => 'Pseudogroup for internal use',        # loc
60     }, );
61
62 @Queues = ({ Name              => 'support',
63              Description       => 'Queue for general issues',
64              CorrespondAddress => 'support@PLC_RT_HOSTNAME',
65              CommentAddress    => '', },
66
67                    { Name              => 'monitor',
68              Description       => 'Queue for monitor',
69              CorrespondAddress => 'monitor@PLC_RT_HOSTNAME',
70              CommentAddress    => '', },
71
72                    { Name              => 'security',
73              Description       => 'Queue for security issues',
74              CorrespondAddress => 'security@PLC_RT_HOSTNAME',
75              CommentAddress    => '', },
76
77                    { Name              => 'legal',
78              Description       => 'Queue for legal issues',
79              CorrespondAddress => 'legal@PLC_RT_HOSTNAME',
80              CommentAddress    => '', },
81
82            { Name        => '___Approvals',
83              Description => 'A system-internal queue for the approvals system',
84              Disabled    => 2, } );
85
86 @ScripActions = (
87
88     {  Name        => 'Autoreply To Requestors',    # loc
89        Description =>
90 'Always sends a message to the requestors independent of message sender' ,                                            # loc
91        ExecModule => 'Autoreply',
92        Argument   => 'Requestor' },
93     { Name        => 'Notify Requestors',                    # loc
94       Description => 'Sends a message to the requestors',    # loc
95       ExecModule  => 'Notify',
96       Argument    => 'Requestor' },
97     { Name        => 'Notify Owner as Comment',              # loc
98       Description => 'Sends mail to the owner',              # loc
99       ExecModule  => 'NotifyAsComment',
100       Argument    => 'Owner' },
101     { Name        => 'Notify Owner',                         # loc
102       Description => 'Sends mail to the owner',              # loc
103       ExecModule  => 'Notify',
104       Argument    => 'Owner' },
105     { Name        => 'Notify Ccs as Comment',              # loc
106       Description => 'Sends mail to the Ccs as a comment', # loc
107       ExecModule  => 'NotifyAsComment',
108       Argument    => 'Cc' },
109     { Name        => 'Notify Ccs',                                   # loc
110       Description => 'Sends mail to the Ccs',                        # loc
111       ExecModule  => 'Notify',
112       Argument    => 'Cc' },
113     { Name        => 'Notify AdminCcs as Comment',                        # loc
114       Description => 'Sends mail to the administrative Ccs as a comment', # loc
115       ExecModule  => 'NotifyAsComment',
116       Argument    => 'AdminCc' },
117     { Name        => 'Notify AdminCcs',                                   # loc
118       Description => 'Sends mail to the administrative Ccs',              # loc
119       ExecModule  => 'Notify',
120       Argument    => 'AdminCc' },
121
122     { Name        => 'Notify Requestors and Ccs as Comment',              # loc
123       Description => 'Send mail to requestors and Ccs as a comment',      # loc
124       ExecModule  => 'NotifyAsComment',
125       Argument    => 'Requestor,Cc' },
126
127     { Name        => 'Notify Requestors and Ccs',                         # loc
128       Description => 'Send mail to requestors and Ccs',                   # loc
129       ExecModule  => 'Notify',
130       Argument    => 'Requestor,Cc' },
131
132     { Name        => 'Notify Requestors, Ccs and AdminCcs as Comment',    # loc
133       Description => 'Send mail to all watchers as a "comment"',          # loc
134       ExecModule  => 'NotifyAsComment',
135       Argument    => 'All' },
136     { Name        => 'Notify Requestors, Ccs and AdminCcs',               # loc
137       Description => 'Send mail to all watchers',                         # loc
138       ExecModule  => 'Notify',
139       Argument    => 'All' },
140     { Name        => 'Notify Other Recipients as Comment',                # loc
141       Description => 'Sends mail to explicitly listed Ccs and Bccs',      # loc
142       ExecModule  => 'NotifyAsComment',
143       Argument    => 'OtherRecipients' },
144     { Name        => 'Notify Other Recipients',                           # loc
145       Description => 'Sends mail to explicitly listed Ccs and Bccs',      # loc
146       ExecModule  => 'Notify',
147       Argument    => 'OtherRecipients' },
148     { Name        => 'User Defined',                                      # loc
149       Description => 'Perform a user-defined action',                     # loc
150       ExecModule  => 'UserDefined', },
151     {  Name        => 'Create Tickets',                                    # loc
152        Description =>
153          'Create new tickets based on this scrip\'s template',             # loc
154        ExecModule => 'CreateTickets', },
155     { Name        => 'Open Tickets',
156       Description => 'Open tickets on correspondence',                    # loc
157       ExecModule  => 'AutoOpen' },
158 );
159
160 @ScripConditions = (
161     { Name                 => 'On Create',                                # loc
162       Description          => 'When a ticket is created',                 # loc
163       ApplicableTransTypes => 'Create',
164       ExecModule           => 'AnyTransaction', },
165
166     { Name                 => 'On Transaction',                           # loc
167       Description          => 'When anything happens',                    # loc
168       ApplicableTransTypes => 'Any',
169       ExecModule           => 'AnyTransaction', },
170     {
171
172       Name                 => 'On Correspond',                             # loc
173       Description          => 'Whenever correspondence comes in',          # loc
174       ApplicableTransTypes => 'Correspond',
175       ExecModule           => 'AnyTransaction', },
176
177     {
178
179       Name                 => 'On Comment',                                # loc
180       Description          => 'Whenever comments come in',                 # loc
181       ApplicableTransTypes => 'Comment',
182       ExecModule           => 'AnyTransaction' },
183     {
184
185       Name                 => 'On Status Change',                          # loc
186       Description          => 'Whenever a ticket\'s status changes',       # loc
187       ApplicableTransTypes => 'Status',
188       ExecModule           => 'AnyTransaction',
189
190     },
191     {
192
193       Name                 => 'On Priority Change',                       # loc
194       Description          => 'Whenever a ticket\'s priority changes',    # loc
195       ApplicableTransTypes => 'Set',
196       ExecModule           => 'PriorityChange',
197     },
198     {
199
200       Name                 => 'On Owner Change',                           # loc
201       Description          => 'Whenever a ticket\'s owner changes',        # loc
202       ApplicableTransTypes => 'Any',
203       ExecModule           => 'OwnerChange',
204
205     },
206     {
207
208       Name                 => 'On Queue Change',                           # loc
209       Description          => 'Whenever a ticket\'s queue changes',        # loc
210       ApplicableTransTypes => 'Set',
211       ExecModule           => 'QueueChange',
212
213     },
214     {  Name                 => 'On Resolve',                               # loc
215        Description          => 'Whenever a ticket is resolved',            # loc
216        ApplicableTransTypes => 'Status',
217        ExecModule           => 'StatusChange',
218        Argument             => 'resolved'
219
220     },
221
222     {  Name                 => 'User Defined',                             # loc
223        Description          => 'Whenever a user-defined condition occurs', # loc
224        ApplicableTransTypes => 'Any',
225        ExecModule           => 'UserDefined'
226
227     },
228
229 );
230
231 @Templates = (
232     { Queue       => '0',
233       Name        => 'Blank',                                             # loc
234       Description => 'A blank template',                                  # loc
235       Content     => '', },
236     {  Queue       => '0',
237        Name        => 'Autoreply',                                         # loc
238        Description => 'Default Autoresponse template',                     # loc
239        Content     => 'Subject: AutoReply: {$Ticket->Subject}
240
241
242 Greetings,
243
244 This message has been automatically generated in response to the
245 creation of a trouble ticket regarding:
246         "{$Ticket->Subject()}", 
247 a summary of which appears below.
248
249 There is no need to reply to this message right now.  Your ticket has been
250 assigned an ID of [{$rtname} #{$Ticket->id()}].
251
252 Please include the string:
253
254          [{$rtname} #{$Ticket->id}]
255
256 in the subject line of all future correspondence about this issue. To do so, 
257 you may reply to this message.
258
259                         Thank you,
260                         {$Ticket->QueueObj->CorrespondAddress()}
261
262 -------------------------------------------------------------------------
263 {$Transaction->Content()}
264 '
265     },
266
267     {  Queue       => '0',
268        Name        => 'Transaction',                     # loc
269        Description => 'Default transaction template',    # loc
270        Content     => 'RT-Attach-Message: yes
271
272
273 {$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
274 Transaction: {$Transaction->Description}
275        Queue: {$Ticket->QueueObj->Name}
276      Subject: {$Transaction->Subject || $Ticket->Subject || "(No subject given)"}
277        Owner: {$Ticket->OwnerObj->Name}
278   Requestors: {$Ticket->RequestorAddresses}
279       Status: {$Ticket->Status}
280  Ticket <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
281
282
283 {$Transaction->Content()}
284 '
285     },
286
287     {
288
289       Queue       => '0',
290       Name        => 'Admin Correspondence',                     # loc
291       Description => 'Default admin correspondence template',    # loc
292       Content     => 'RT-Attach-Message: yes
293
294
295 <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
296
297 {$Transaction->Content()}
298 '
299     },
300
301     {  Queue       => '0',
302        Name        => 'Correspondence',                          # loc
303        Description => 'Default correspondence template',         # loc
304        Content     => 'RT-Attach-Message: yes
305
306 {$Transaction->Content()}
307 '
308     },
309
310     {  Queue       => '0',
311        Name        => 'Admin Comment',                           # loc
312        Description => 'Default admin comment template',          # loc
313        Content     =>
314 'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\\[Comment\\]//g; $comment =~ s/^Re//i; $s;}
315
316
317 {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
318 This is a comment.  It is not sent to the Requestor(s):
319
320 {$Transaction->Content()}
321 '
322     },
323
324     {  Queue       => '0',
325        Name        => 'Status Change',                                     # loc
326        Description => 'Ticket status changed',                             # loc
327        Content     => 'Subject: Status Changed to: {$Transaction->NewValue}
328
329
330 {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
331
332 {$Transaction->Content()}
333 '
334     },
335
336     {
337
338       Queue       => '0',
339       Name        => 'Resolved',                 # loc
340       Description => 'Ticket Resolved',          # loc
341       Content     => 'Subject: Resolved: {$Ticket->Subject}
342
343 According to our records, your request has been resolved. If you have any
344 further questions or concerns, please respond to this message.
345 '
346     },
347     {  Queue       => '___Approvals',
348        Name        => "New Pending Approval",    # loc
349        Description =>
350          "Notify Owners and AdminCcs of new items pending their approval", # loc
351        Content => 'Subject: New Pending Approval: {$Ticket->Subject}
352
353 Greetings,
354
355 There is a new item pending your approval: "{$Ticket->Subject()}", 
356 a summary of which appears below.
357
358 Please visit {$RT::WebURL}Approvals/Display.html?id={$Ticket->id}
359 to approve or reject this ticket, or {$RT::WebURL}Approvals/ to
360 batch-process all your pending approvals.
361
362 -------------------------------------------------------------------------
363 {$Transaction->Content()}
364 '
365     },
366     {  Queue       => '___Approvals',
367        Name        => "Approval Passed",    # loc
368        Description =>
369          "Notify Owner of their ticket has been approved by some approver", # loc
370        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
371
372 Greetings,
373
374 Your ticket has been approved by { eval { $Approval->OwnerObj->Name } }.
375 Other approvals may be pending.
376 '
377     },
378     {  Queue       => '___Approvals',
379        Name        => "All Approvals Passed",    # loc
380        Description =>
381          "Notify Owner of their ticket has been approved by all approvers", # loc
382        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
383
384 Greetings,
385
386 Your ticket has been approved.  Its Owner may now start to act on it.
387 '
388     },
389     {  Queue       => '___Approvals',
390        Name        => "Approval Rejected",    # loc
391        Description =>
392          "Notify Owner of their rejected ticket", # loc
393        Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
394
395 Greetings,
396
397 Your ticket has been rejected by { eval { $Approval->OwnerObj->Name } }.
398 '
399     },
400 );
401 # }}}
402
403 @Scrips = (
404     {  ScripCondition => 'On Correspond',
405        ScripAction    => 'Open Tickets',
406        Template       => 'Blank' },
407     {  ScripCondition => 'On Owner Change',
408        ScripAction    => 'Notify Owner',
409        Template       => 'Transaction' },
410     {  ScripCondition => 'On Create',
411        ScripAction    => 'AutoReply To Requestors',
412        Template       => 'AutoReply' },
413     {  ScripCondition => 'On Create',
414        ScripAction    => 'Notify AdminCcs',
415        Template       => 'Transaction' },
416     {  ScripCondition => 'On Correspond',
417        ScripAction    => 'Notify AdminCcs',
418        Template       => 'Admin Correspondence' },
419     {  ScripCondition => 'On Correspond',
420        ScripAction    => 'Notify Requestors And Ccs',
421        Template       => 'Correspondence' },
422     {  ScripCondition => 'On Correspond',
423        ScripAction    => 'Notify Other Recipients',
424        Template       => 'Correspondence' },
425     {  ScripCondition => 'On Comment',
426        ScripAction    => 'Notify AdminCcs As Comment',
427        Template       => 'Admin Comment' },
428     {  ScripCondition => 'On Comment',
429        ScripAction    => 'Notify Other Recipients As Comment',
430        Template       => 'Correspondence' },
431     {  ScripCondition => 'On Resolve',
432        ScripAction    => 'Notify Requestors',
433        Template       => 'Resolved' },
434     {  Description => "When an approval ticket is created, notify the Owner and AdminCc of the item awaiting their approval",    # loc
435        Queue          => '___Approvals',
436        ScripCondition => 'User Defined',
437        CustomIsApplicableCode => q[
438             $self->TicketObj->Type eq 'approval'        and
439             $self->TransactionObj->Field eq 'Status'    and
440             $self->TransactionObj->NewValue eq 'open'   and
441             eval { $T::Approving = ($self->TicketObj->AllDependedOnBy( Type => 'ticket' ))[0] }
442        ],
443        ScripAction    => 'Notify Owner',
444        Template       => 'New Pending Approval' },
445     {  Description => "If an approval is rejected, reject the original and delete pending approvals",    # loc
446        Queue            => '___Approvals',
447        ScripCondition   => 'On Status Change',
448        ScripAction      => 'User Defined',
449        CustomPrepareCode => q[
450 # ------------------------------------------------------------------- #
451 return(0) unless ( lc($self->TransactionObj->NewValue) eq "rejected" or
452                    lc($self->TransactionObj->NewValue) eq "deleted" );
453
454 my $rejected = 0;
455 my $links = $self->TicketObj->DependedOnBy;
456 foreach my $link (@{ $links->ItemsArrayRef }) {
457     my $obj = $link->BaseObj;
458     if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
459         if ($obj->Type eq 'ticket') {
460             $obj->Comment(
461                 Content => $self->loc("Your request was rejected."),
462             );
463             $obj->SetStatus(
464                 Status  => 'rejected',
465                 Force   => 1,
466             );
467
468             $T::Approval = $self->TicketObj; # so we can access it inside templates
469             $self->{TicketObj} = $obj;  # we want the original id in the token line
470             $rejected = 1;
471         }
472         else {
473             $obj->SetStatus(
474                 Status  => 'deleted',
475                 Force   => 1,
476             );
477         }
478     }
479 }
480
481 $links = $self->TicketObj->DependsOn;
482 foreach my $link (@{ $links->ItemsArrayRef }) {
483     my $obj = $link->TargetObj;
484     if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
485         $obj->SetStatus(
486             Status      => 'deleted',
487             Force       => 1,
488         );
489     }
490 }
491
492 # Now magically turn myself into a Requestor Notify object...
493 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
494 $self->{Argument} = 'Requestor'; $self->Prepare;
495
496 return $rejected;
497 # ------------------------------------------------------------------- #
498         ],
499        CustomCommitCode => '"never needed"',
500        Template          => 'Approval Rejected', },
501     {  Description => "When a ticket has been approved by any approver, add correspondence to the original ticket", # loc
502        Queue             => '___Approvals',
503        ScripCondition    => 'On Resolve',
504        ScripAction       => 'User Defined',
505        CustomPrepareCode => q[
506 # ------------------------------------------------------------------- #
507 return(0) unless ($self->TicketObj->Type eq 'approval');
508
509 my $note;
510 my $t = $self->TicketObj->Transactions;
511 while (my $o = $t->Next) {
512     $note .= $o->Content . "\n" if $o->ContentObj
513             and $o->Content !~ /Default Approval/;
514 }
515
516 foreach my $obj ($self->TicketObj->AllDependedOnBy( Type => 'ticket' )) {
517     $obj->Comment(
518         Content => $self->loc( "Your request has been approved by [_1]. Other approvals may still be pending.", # loc
519             $self->TransactionObj->CreatorObj->Name,
520         ) . "\n" . $self->loc( "Approver's notes: [_1]", # loc
521             $note
522         ),
523     );
524     $T::Approval = $self->TicketObj; # so we can access it inside templates
525     $self->{TicketObj} = $obj;  # we want the original id in the token line
526 }
527
528 # Now magically turn myself into a Requestor Notify object...
529 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
530 $self->{Argument} = 'Requestor'; $self->Prepare;
531
532 return 1;
533 # ------------------------------------------------------------------- #
534         ],
535        CustomCommitCode => '"never needed"',
536        Template => 'Approval Passed' },
537     {  Description => "When a ticket has been approved by all approvers, add correspondence to the original ticket", # loc
538        Queue             => '___Approvals',
539        ScripCondition    => 'On Resolve',
540        ScripAction       => 'User Defined',
541        CustomPrepareCode  => q[
542 # ------------------------------------------------------------------- #
543 # Find all the tickets that depend on this (that this is approving)
544
545 my $Ticket = $self->TicketObj;
546 my @TOP    = $Ticket->AllDependedOnBy( Type => 'ticket' );
547 my $links  = $Ticket->DependedOnBy;
548 my $passed = 0;
549
550 while (my $link = $links->Next) {
551     my $obj = $link->BaseObj;
552     next if ($obj->HasUnresolvedDependencies( Type => 'approval' ));
553
554     if ($obj->Type eq 'ticket') {
555         $obj->Comment(
556             Content     => $self->loc("Your request has been approved."),
557         );
558         $T::Approval  = $Ticket;    # so we can access it inside templates
559         $self->{TicketObj} = $obj;  # we want the original id in the token line
560         $passed = 1;
561     }
562     elsif ($obj->Type eq 'approval') {
563         $obj->SetStatus( Status => 'open', Force => 1 );
564     }
565     elsif ($RT::UseCodeTickets and $obj->Type eq 'code') {
566         my $code = $obj->Transactions->First->Content;
567         my $rv;
568
569         foreach my $TOP (@TOP) {
570             local $@;
571             $rv++ if eval $code;
572             $RT::Logger->error("Cannot eval code: $@") if $@;
573         }
574
575         if ($rv or !@TOP) {
576             $obj->SetStatus( Status     => 'resolved', Force    => 1,);
577         }
578         else {
579             $obj->SetStatus( Status     => 'rejected', Force    => 1,);
580         }
581     }
582 }
583
584 # Now magically turn myself into a Requestor Notify object...
585 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
586 $self->{Argument} = 'Requestor'; $self->Prepare;
587
588 return 0; # ignore $passed;
589 # ------------------------------------------------------------------- #
590         ],
591        CustomCommitCode => '"never needed"',
592        Template => 'All Approvals Passed', },
593
594 );
595
596 @ACL = (
597     { UserId => 'Nobody',      # - principalId
598       Right  => 'OwnTicket', },
599
600     { UserId => 'root',        # - principalid
601       Right  => 'SuperUser', },
602
603 );
604
605 # Predefined searches
606
607 @Attributes = (
608     { Name => 'Search - My Tickets',
609       Description => '[_1] highest priority tickets I own', # loc
610       Content     =>
611       { Format => "'<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', Priority, QueueName, ExtendedStatus",
612         Query   => " Owner = '__CurrentUser__' AND ( Status = 'new' OR Status = 'open')",
613         OrderBy => 'Priority',
614         Order   => 'DESC' },
615     },
616     { Name => 'Search - Unowned Tickets',
617       Description => '[_1] newest unowned tickets', # loc
618       Content     =>
619 # 'Take' #loc
620       { Format => "'<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', QueueName, ExtendedStatus, CreatedRelative, '<A HREF=\"__WebPath__/Ticket/Display.html?Action=Take&id=__id__\">__loc(Take)__</a>/TITLE:&nbsp;' ",
621         Query   => " Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')",
622         OrderBy => 'Created',
623         Order   => 'DESC' },
624     },
625     { Name => 'HomepageSettings',
626       Description => 'HomepageSettings',
627       Content =>
628       { 'body' => # loc
629         [ { type => 'system', name => 'My Tickets' },
630           { type => 'system', name => 'Unowned Tickets' },
631           { type => 'component',  name => 'QuickCreate'},
632         ],
633         'summary' => # loc
634         [ 
635           { type => 'component', name => 'MyReminders' },
636           { type => 'component', name => 'Quicksearch' },
637           { type => 'component', name => 'RefreshHomepage' },
638         ]
639     },
640 }
641 );