[Rt-commit] rt branch, showglobaltemplates, created. rt-3.8.8-183-g605565b
Alex Vandiver
alexmv at bestpractical.com
Tue Jul 27 17:09:49 EDT 2010
The branch, showglobaltemplates has been created
at 605565b99070caa311c418011e673c296e856d53 (commit)
- Log -----------------------------------------------------------------
commit 1c33536b4b71951770acabdb9776288830e31935
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 324bf0b..9ce0549 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 1a3e1651dbcf0ae972f53bff9015e963fe7e2efa
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 605565b99070caa311c418011e673c296e856d53
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