[Rt-commit] rt branch, showglobaltemplates, created. rt-3.8.8-121-ga460a3c
Chia-liang Kao
clkao at bestpractical.com
Fri Jul 23 06:28:34 EDT 2010
The branch, showglobaltemplates has been created
at a460a3c925558e2ad6d95e83d104467a61f64ec7 (commit)
- Log -----------------------------------------------------------------
commit 60254f5e63900884a3505f1c7108bf815c4eb7ae
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Wed Jul 21 22:20:10 2010 +0800
localize tsv header and status field.
diff --git a/share/html/Search/Results.tsv b/share/html/Search/Results.tsv
index 946a35d..125d3f8 100644
--- a/share/html/Search/Results.tsv
+++ b/share/html/Search/Results.tsv
@@ -95,6 +95,8 @@ my @attrs = qw(
ResolvedObj->ISO LastUpdatedObj->ISO
);
+my $should_loc = { map { $_ => 1 } qw(Status) };
+
$r->content_type('application/vnd.ms-excel');
{
my @header;
@@ -102,7 +104,7 @@ $r->content_type('application/vnd.ms-excel');
my $label = $attr;
$label =~ s'Obj-.(?:AsString|Name|ISO)''g;
$label =~ s'-\>MemberEmailAddressesAsString''g;
- push @header, $label;
+ push @header, loc($label);
}
$_ += @header - 1 foreach values %cf_name_to_pos;
@@ -128,7 +130,7 @@ while ( my $Ticket = $Tickets->Next()) {
$value = eval $method;
if ($@) {die "Failed to find $attr - ". $@};
}
- push @row, $value;
+ push @row, $should_loc->{$attr} ? loc($value) : $value;
}
my $values = $Ticket->CustomFieldValues;
commit 814b820717615a232a805fd756897391c1341e15
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Fri Jul 23 18:22:17 2010 +0800
refactor showtemplate permission check.
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index fce37bc..8b0883e 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -111,7 +111,7 @@ if the user passes an ACL check, otherwise returns undef.
sub _Value {
my $self = shift;
- unless ( $self->CurrentUserHasQueueRight('ShowTemplate') ) {
+ unless ( $self->CurrentUserCanRead() ) {
return undef;
}
return $self->__Value( @_ );
@@ -375,7 +375,7 @@ sub _ParseContent {
@_
);
- unless ( $self->CurrentUserHasQueueRight('ShowTemplate') ) {
+ unless ( $self->CurrentUserCanRead() ) {
return (undef, $self->loc("Permission Denied"));
}
@@ -470,4 +470,16 @@ sub CurrentUserHasQueueRight {
return ( $self->QueueObj->CurrentUserHasRight(@_) );
}
+=head2 CurrentUserCanRead
+
+=cut
+
+sub CurrentUserCanRead {
+ my $self =shift;
+ return $self->QueueObj->Id
+ ? $self->CurrentUserHasQueueRight('ShowTemplate')
+ : $self->CurrentUser->HasRight( Right =>'ShowGlobalTemplates', Object => $RT::System );
+}
+
+
1;
commit 231f4c6f3d44cacbfb461837ac2a3c4c459b39d7
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Fri Jul 23 18:22:43 2010 +0800
ShowGlobalTemplates rights
diff --git a/lib/RT/System.pm b/lib/RT/System.pm
index 2a23e32..825764b 100755
--- a/lib/RT/System.pm
+++ b/lib/RT/System.pm
@@ -87,6 +87,7 @@ our $RIGHTS = {
"Delegate specific rights which have been granted to you.", # loc_pair
ShowConfigTab => "show Configuration tab", # loc_pair
ShowApprovalsTab => "show Approvals tab", # loc_pair
+ ShowGlobalTemplates => "show global templates", # loc_pair
LoadSavedSearch => "allow loading of saved searches", # loc_pair
CreateSavedSearch => "allow creation of saved searches", # loc_pair
};
commit a460a3c925558e2ad6d95e83d104467a61f64ec7
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Fri Jul 23 18:27:26 2010 +0800
recognize ShowGlobalTemplates rights in templates iterator.
diff --git a/lib/RT/Templates_Overlay.pm b/lib/RT/Templates_Overlay.pm
index c031277..bd498f1 100755
--- a/lib/RT/Templates_Overlay.pm
+++ b/lib/RT/Templates_Overlay.pm
@@ -178,7 +178,8 @@ sub Next {
# If it's part of a queue, and the user can read templates in
# that queue, or the user can globally read templates, show it
if ($templ->Queue && $templ->CurrentUserHasQueueRight('ShowTemplate') or
- $templ->CurrentUser->HasRight(Object => $RT::System, Right => 'ShowTemplate')) {
+ $templ->CurrentUser->HasRight(Object => $RT::System, Right => 'ShowTemplate') or
+ $templ->CurrentUser->HasRight(Object => $RT::System, Right => 'ShowGlobalTemplates')) {
return($templ);
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list