"Fossies" - the Fresh Open Source Software Archive 
Member "RT-Extension-Assets-1.05/etc/initialdata" (4 May 2015, 1305 Bytes) of package /linux/misc/RT-Extension-Assets-1.05.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the latest
Fossies "Diffs" side-by-side code changes report for "initialdata":
1.04_vs_1.05.
1 use strict;
2 use warnings;
3
4 # Temporarily enable the plugin so the asset lifecycle exists
5 unless (grep {$_ eq "RT::Extension::Assets"} RT->Config->Get('Plugins')) {
6 RT->Config->Set('Plugins', (RT->Config->Get('Plugins'), "RT::Extension::Assets"));
7 RT->InitPluginPaths;
8 RT->Config->LoadConfig( File => "Assets_Config.pm" );
9 RT::Lifecycle->FillCache;
10 require RT::Extension::Assets;
11 }
12
13 require RT::Asset;
14
15 our (@Final);
16
17 # Create global role groups
18 push @Final, sub {
19 foreach my $type (RT::Asset->Roles) {
20 next if $type eq "Owner"; # There's a core global role group for Owner
21
22 my $group = RT::Group->new( RT->SystemUser );
23 my ($ok, $msg) = $group->CreateRoleGroup(
24 Object => RT->System,
25 Name => $type,
26 InsideTransaction => 0,
27 );
28 RT->Logger->error("Couldn't create global asset role group '$type': $msg")
29 unless $ok;
30 }
31 };
32
33 # Create default catalog
34 push @Final, sub {
35 my $catalog = RT::Catalog->new( RT->SystemUser );
36 my ($ok, $msg) = $catalog->Create(
37 Name => "General assets",
38 Description => "The default catalog",
39 );
40 RT->Logger->error("Couldn't create default catalog 'General assets': $msg")
41 unless $ok;
42 };
43
44 1;