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