6 RT->Logger->debug('Make sure templates all have known types');
8 # We update all NULL rows, below. We want to find non-NULL
9 # rows, which weren't created by the current codebase running
10 # through earlier initialdatas. Type != 'Perl' enforces the
11 # non-NULL part, as well
12 my $templates = RT::Templates->new(RT->SystemUser);
19 if ($templates->Count) {
20 die "You have templates with Type already set. This will interfere with your upgrade because RT used to ignore the template Type field, but now uses it.";
23 $templates = RT::Templates->new(RT->SystemUser);
29 while (my $template = $templates->Next) {
30 my ($status, $msg) = $template->SetType('Perl');
31 RT->Logger->warning( "Couldn't change Type of Template #" . $template->Id . ": $msg" ) unless $status;
35 RT->Logger->debug('Adding ExecuteCode right to principals that currently have ModifyTemplate or ModifyScrips');
37 my $acl = RT::ACL->new(RT->SystemUser);
41 VALUE => 'ModifyTemplate',
42 ENTRYAGGREGATOR => 'OR',
47 VALUE => 'ModifyScrips',
48 ENTRYAGGREGATOR => 'OR',
51 while (my $ace = $acl->Next) {
52 my $principal = $ace->PrincipalObj;
53 next if $principal->HasRight(
54 Right => 'ExecuteCode',
55 Object => $RT::System,
58 my ($ok, $msg) = $principal->GrantRight(
59 Right => 'ExecuteCode',
60 Object => $RT::System,
64 RT->Logger->warn("Unable to grant ExecuteCode on principal " . $principal->id . ": $msg");