183b7cfd64f8b65a42b461a3acc3e26f891dca89
[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     => 'RT Admin',
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       => 'Support',
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 Hello,
242
243 Thank you very much for reporting this.
244
245 This message was automatically generated in response to the
246 creation of a trouble ticket regarding:
247
248         "{$Ticket->Subject()}"
249
250 There is no need to reply to this message right now.  Your ticket has been
251 assigned an ID of [{$rtname} #{$Ticket->id()}].
252
253 Please include the string:
254
255     [{$rtname} #{$Ticket->id}]
256
257 in the subject line of all future correspondence about this issue. To do so, 
258 you may reply to this message.
259
260 Thank you,
261 {$Ticket->QueueObj->CorrespondAddress()}
262 {$Ticket->AddCustomFieldValue(Field => 'Problem Category', Value => 'Trivial');}
263
264 -------------------------------------------------------------------------
265 {$Transaction->Content()}
266 '
267     },
268
269     {  Queue       => '0',
270        Name        => 'Transaction',                     # loc
271        Description => 'Default transaction template',    # loc
272        Content     => 'RT-Attach-Message: yes
273
274
275 {$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
276 Transaction: {$Transaction->Description}
277        Queue: {$Ticket->QueueObj->Name}
278      Subject: {$Transaction->Subject || $Ticket->Subject || "(No subject given)"}
279        Owner: {$Ticket->OwnerObj->Name}
280   Requestors: {$Ticket->RequestorAddresses}
281       Status: {$Ticket->Status}
282  Ticket <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
283
284
285 {$Transaction->Content()}
286 '
287     },
288
289     {
290
291       Queue       => '0',
292       Name        => 'Admin Correspondence',                     # loc
293       Description => 'Default admin correspondence template',    # loc
294       Content     => 'RT-Attach-Message: yes
295
296
297 <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
298
299 {$Transaction->Content()}
300 '
301     },
302
303     {  Queue       => '0',
304        Name        => 'Correspondence',                          # loc
305        Description => 'Default correspondence template',         # loc
306        Content     => 'RT-Attach-Message: yes
307
308 {$Transaction->Content()}
309 '
310     },
311
312     {  Queue       => '0',
313        Name        => 'Admin Comment',                           # loc
314        Description => 'Default admin comment template',          # loc
315        Content     =>
316 'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\\[Comment\\]//g; $comment =~ s/^Re//i; $s;}
317
318
319 {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
320 This is a comment.  It is not sent to the Requestor(s):
321
322 {$Transaction->Content()}
323 '
324     },
325
326     {  Queue       => '0',
327        Name        => 'Status Change',                                     # loc
328        Description => 'Ticket status changed',                             # loc
329        Content     => 'Subject: Status Changed to: {$Transaction->NewValue}
330
331
332 {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
333
334 {$Transaction->Content()}
335 '
336     },
337
338     {
339
340       Queue       => '0',
341       Name        => 'Resolved',                 # loc
342       Description => 'Ticket Resolved',          # loc
343       Content     => 'Subject: Resolved: {$Ticket->Subject}
344
345 According to our records, your request has been resolved. If you have any
346 further questions or concerns, please respond to this message.
347 '
348     },
349     {  Queue       => '___Approvals',
350        Name        => "New Pending Approval",    # loc
351        Description =>
352          "Notify Owners and AdminCcs of new items pending their approval", # loc
353        Content => 'Subject: New Pending Approval: {$Ticket->Subject}
354
355 Greetings,
356
357 There is a new item pending your approval: "{$Ticket->Subject()}", 
358 a summary of which appears below.
359
360 Please visit {$RT::WebURL}Approvals/Display.html?id={$Ticket->id}
361 to approve or reject this ticket, or {$RT::WebURL}Approvals/ to
362 batch-process all your pending approvals.
363
364 -------------------------------------------------------------------------
365 {$Transaction->Content()}
366 '
367     },
368     {  Queue       => '___Approvals',
369        Name        => "Approval Passed",    # loc
370        Description =>
371          "Notify Owner of their ticket has been approved by some approver", # loc
372        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
373
374 Greetings,
375
376 Your ticket has been approved by { eval { $Approval->OwnerObj->Name } }.
377 Other approvals may be pending.
378 '
379     },
380     {  Queue       => '___Approvals',
381        Name        => "All Approvals Passed",    # loc
382        Description =>
383          "Notify Owner of their ticket has been approved by all approvers", # loc
384        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
385
386 Greetings,
387
388 Your ticket has been approved.  Its Owner may now start to act on it.
389 '
390     },
391     {  Queue       => '___Approvals',
392        Name        => "Approval Rejected",    # loc
393        Description =>
394          "Notify Owner of their rejected ticket", # loc
395        Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
396
397 Greetings,
398
399 Your ticket has been rejected by { eval { $Approval->OwnerObj->Name } }.
400 '
401     },
402 );
403 # }}}
404
405 @Scrips = (
406     {  ScripCondition => 'On Correspond',
407        ScripAction    => 'Open Tickets',
408        Template       => 'Blank' },
409     {  ScripCondition => 'On Owner Change',
410        ScripAction    => 'Notify Owner',
411        Template       => 'Transaction' },
412     {  ScripCondition => 'On Create',
413        ScripAction    => 'AutoReply To Requestors',
414        Template       => 'AutoReply' },
415     {  ScripCondition => 'On Create',
416        ScripAction    => 'Notify AdminCcs',
417        Template       => 'Transaction' },
418     {  ScripCondition => 'On Correspond',
419        ScripAction    => 'Notify AdminCcs',
420        Template       => 'Admin Correspondence' },
421     {  ScripCondition => 'On Correspond',
422        ScripAction    => 'Notify Requestors And Ccs',
423        Template       => 'Correspondence' },
424     {  ScripCondition => 'On Correspond',
425        ScripAction    => 'Notify Other Recipients',
426        Template       => 'Correspondence' },
427     {  ScripCondition => 'On Comment',
428        ScripAction    => 'Notify AdminCcs As Comment',
429        Template       => 'Admin Comment' },
430     {  ScripCondition => 'On Comment',
431        ScripAction    => 'Notify Other Recipients As Comment',
432        Template       => 'Correspondence' },
433     {  ScripCondition => 'On Resolve',
434        ScripAction    => 'Notify Requestors',
435        Template       => 'Resolved' },
436     {  Description => "When an approval ticket is created, notify the Owner and AdminCc of the item awaiting their approval",    # loc
437        Queue          => '___Approvals',
438        ScripCondition => 'User Defined',
439        CustomIsApplicableCode => q[
440             $self->TicketObj->Type eq 'approval'        and
441             $self->TransactionObj->Field eq 'Status'    and
442             $self->TransactionObj->NewValue eq 'open'   and
443             eval { $T::Approving = ($self->TicketObj->AllDependedOnBy( Type => 'ticket' ))[0] }
444        ],
445        ScripAction    => 'Notify Owner',
446        Template       => 'New Pending Approval' },
447     {  Description => "If an approval is rejected, reject the original and delete pending approvals",    # loc
448        Queue            => '___Approvals',
449        ScripCondition   => 'On Status Change',
450        ScripAction      => 'User Defined',
451        CustomPrepareCode => q[
452 # ------------------------------------------------------------------- #
453 return(0) unless ( lc($self->TransactionObj->NewValue) eq "rejected" or
454                    lc($self->TransactionObj->NewValue) eq "deleted" );
455
456 my $rejected = 0;
457 my $links = $self->TicketObj->DependedOnBy;
458 foreach my $link (@{ $links->ItemsArrayRef }) {
459     my $obj = $link->BaseObj;
460     if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
461         if ($obj->Type eq 'ticket') {
462             $obj->Comment(
463                 Content => $self->loc("Your request was rejected."),
464             );
465             $obj->SetStatus(
466                 Status  => 'rejected',
467                 Force   => 1,
468             );
469
470             $T::Approval = $self->TicketObj; # so we can access it inside templates
471             $self->{TicketObj} = $obj;  # we want the original id in the token line
472             $rejected = 1;
473         }
474         else {
475             $obj->SetStatus(
476                 Status  => 'deleted',
477                 Force   => 1,
478             );
479         }
480     }
481 }
482
483 $links = $self->TicketObj->DependsOn;
484 foreach my $link (@{ $links->ItemsArrayRef }) {
485     my $obj = $link->TargetObj;
486     if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
487         $obj->SetStatus(
488             Status      => 'deleted',
489             Force       => 1,
490         );
491     }
492 }
493
494 # Now magically turn myself into a Requestor Notify object...
495 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
496 $self->{Argument} = 'Requestor'; $self->Prepare;
497
498 return $rejected;
499 # ------------------------------------------------------------------- #
500         ],
501        CustomCommitCode => '"never needed"',
502        Template          => 'Approval Rejected', },
503     {  Description => "When a ticket has been approved by any approver, add correspondence to the original ticket", # loc
504        Queue             => '___Approvals',
505        ScripCondition    => 'On Resolve',
506        ScripAction       => 'User Defined',
507        CustomPrepareCode => q[
508 # ------------------------------------------------------------------- #
509 return(0) unless ($self->TicketObj->Type eq 'approval');
510
511 my $note;
512 my $t = $self->TicketObj->Transactions;
513 while (my $o = $t->Next) {
514     $note .= $o->Content . "\n" if $o->ContentObj
515             and $o->Content !~ /Default Approval/;
516 }
517
518 foreach my $obj ($self->TicketObj->AllDependedOnBy( Type => 'ticket' )) {
519     $obj->Comment(
520         Content => $self->loc( "Your request has been approved by [_1]. Other approvals may still be pending.", # loc
521             $self->TransactionObj->CreatorObj->Name,
522         ) . "\n" . $self->loc( "Approver's notes: [_1]", # loc
523             $note
524         ),
525     );
526     $T::Approval = $self->TicketObj; # so we can access it inside templates
527     $self->{TicketObj} = $obj;  # we want the original id in the token line
528 }
529
530 # Now magically turn myself into a Requestor Notify object...
531 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
532 $self->{Argument} = 'Requestor'; $self->Prepare;
533
534 return 1;
535 # ------------------------------------------------------------------- #
536         ],
537        CustomCommitCode => '"never needed"',
538        Template => 'Approval Passed' },
539     {  Description => "When a ticket has been approved by all approvers, add correspondence to the original ticket", # loc
540        Queue             => '___Approvals',
541        ScripCondition    => 'On Resolve',
542        ScripAction       => 'User Defined',
543        CustomPrepareCode  => q[
544 # ------------------------------------------------------------------- #
545 # Find all the tickets that depend on this (that this is approving)
546
547 my $Ticket = $self->TicketObj;
548 my @TOP    = $Ticket->AllDependedOnBy( Type => 'ticket' );
549 my $links  = $Ticket->DependedOnBy;
550 my $passed = 0;
551
552 while (my $link = $links->Next) {
553     my $obj = $link->BaseObj;
554     next if ($obj->HasUnresolvedDependencies( Type => 'approval' ));
555
556     if ($obj->Type eq 'ticket') {
557         $obj->Comment(
558             Content     => $self->loc("Your request has been approved."),
559         );
560         $T::Approval  = $Ticket;    # so we can access it inside templates
561         $self->{TicketObj} = $obj;  # we want the original id in the token line
562         $passed = 1;
563     }
564     elsif ($obj->Type eq 'approval') {
565         $obj->SetStatus( Status => 'open', Force => 1 );
566     }
567     elsif ($RT::UseCodeTickets and $obj->Type eq 'code') {
568         my $code = $obj->Transactions->First->Content;
569         my $rv;
570
571         foreach my $TOP (@TOP) {
572             local $@;
573             $rv++ if eval $code;
574             $RT::Logger->error("Cannot eval code: $@") if $@;
575         }
576
577         if ($rv or !@TOP) {
578             $obj->SetStatus( Status     => 'resolved', Force    => 1,);
579         }
580         else {
581             $obj->SetStatus( Status     => 'rejected', Force    => 1,);
582         }
583     }
584 }
585
586 # Now magically turn myself into a Requestor Notify object...
587 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
588 $self->{Argument} = 'Requestor'; $self->Prepare;
589
590 return 0; # ignore $passed;
591 # ------------------------------------------------------------------- #
592         ],
593        CustomCommitCode => '"never needed"',
594        Template => 'All Approvals Passed', },
595
596 );
597
598 @ACL = (
599     { UserId => 'Nobody',      # - principalId
600       Right  => 'OwnTicket', },
601
602     { UserId => 'root',        # - principalid
603       Right  => 'SuperUser', },
604
605 );
606
607 # Predefined searches
608
609 @Attributes = (
610     { Name => 'Search - My Tickets',
611       Description => '[_1] highest priority tickets I own', # loc
612       Content     =>
613       { 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",
614         Query   => " Owner = '__CurrentUser__' AND ( Status = 'new' OR Status = 'open')",
615         OrderBy => 'Priority',
616         Order   => 'DESC' },
617     },
618     { Name => 'Search - Unowned Tickets',
619       Description => '[_1] newest unowned tickets', # loc
620       Content     =>
621 # 'Take' #loc
622       { 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;' ",
623         Query   => " Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')",
624         OrderBy => 'Created',
625         Order   => 'DESC' },
626     },
627     { Name => 'HomepageSettings',
628       Description => 'HomepageSettings',
629       Content =>
630       { 'body' => # loc
631         [ { type => 'system', name => 'My Tickets' },
632           { type => 'system', name => 'Unowned Tickets' },
633           { type => 'component',  name => 'QuickCreate'},
634         ],
635         'summary' => # loc
636         [ 
637           { type => 'component', name => 'MyReminders' },
638           { type => 'component', name => 'Quicksearch' },
639           { type => 'component', name => 'RefreshHomepage' },
640         ]
641     },
642 }
643 );