Site icon Leonid Mamchenkov

RT initialdata and Perl’s nested map

Request Tracker (aka RT) comes with a very powerful, yet not too widely known tool – initialdata.  This helps with automating configuration of the new system and data migration.  Combined with the power of Perl’s map() function, some really awesome things can be done in a jiffy.

Here is a snippet I’ve used recently, to set a list of access rights to a list of queues:

push @ACL, map {
  my $queue = $_;
  map {
    {
      GroupDomain => 'SystemInternal',
      GroupType => 'Everyone',
      Queue => $queue,
      Right => $_,
    }
  } qw(
    CreateTicket
    ReplyToTicket
  )
} qw(
  dpt-Support-EN
  dpt-Support-RU
  dpt-Support-FR
);
Exit mobile version